title: How to get the TextInput value in react-native
body: <p>I have this code where I'm getting a user input. But when I'm console logging it to check it I'm getting an <code>object of type undefined</code>. I'm providing my code here. Please correct my code so that this bug is fixed.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>export default function App() {
    const [enteredGoal, setGoal] = useState('');
    const goalInputHandler = (enteredText) =&gt; {
      setGoal(enteredText);
    };
    const addGoalHandler = () =&gt; {
      console.log(enteredGoal);
    }
    return (
      &lt;View style={styles.screen}&gt;
        &lt;StatusBar style="auto" /&gt;
        &lt;View style={styles.inputTextContainer}&gt;
          &lt;TextInput
          style={styles.TextInput}
            placeholder="Course Goal"
            onChange={goalInputHandler}
            value={enteredGoal}
          /&gt;
          &lt;Button title="ADD"  onPress={addGoalHandler} /&gt;
        &lt;/View&gt;
      &lt;/View&gt;
    );
  }</code></pre>
  </div>
  </div>
  </p>