title: How do I export text to/access text from another file in React Native?
body: <p>In an AuthProvider.js, I have the following code written to catch and log errors in the console.</p>
  <pre><code>export const AuthProvider = ({children}) =&gt; {
      const [user, setUser] = useState(null);
      const [errorText, setErrorText] = useState('')
  
      return (
          &lt;AuthContext.Provider
              value={{
                  user,
                  setUser,
                  login: async (email, password) =&gt; {
                      try {
                          await auth().signInWithEmailAndPassword(email, password)
                      } catch(e) {
                          setErrorText(e);
                          console.log(e)
                      }
                  },
              }}
          &gt;
              {children}
          &lt;/AuthContext.Provider&gt;
      )
  }
  </code></pre>
  <p>I want to export these errors as text (strings) to another file (LoginScreen.js) so that the error can be displayed there in a Text component, as follows:</p>
  <pre><code>&lt;Text style={styles.errorMsg}&gt;{errorText}&lt;/Text&gt;
  </code></pre>
  <p>As you can see, I'm already using a hook to set the error text to the correct value, but I'm not sure how to export this hook into another file, or if there's a better method of exporting a string.</p>