title: React native read TextInput value in realtime without using useState
body: <p>This is a common way to read the <code>TextInput</code> value using <code>onChangeText</code> prop. This way, you can access the <code>value</code> everywhere:</p>
  <pre><code>import React, { Component } from 'react';
  import { TextInput } from 'react-native';
  export default function UselessTextInput() {
    const [value, onChangeText] = React.useState(‘’);
    return (
      &lt;TextInput
        onChangeText={text =&gt; onChangeText(text)}
        value={value}
      /&gt;
    );
  }
  </code></pre>
  <p>However, I don't need to store the <code>value</code> in a state. I just want to read the value in realtime (using something like:</p>
  <pre class="lang-js prettyprint-override"><code>const ref = useRef();
  ref.current.value &lt;== simply use this
  </code></pre>
  <p><strong>Why I need this:</strong>
  The common way I mentioned above is very slow and inefficient. Every single charachter you type, causes a state update. More importantly, if you use RxJs, it is not possible to use the common method, it changes the behavior of your observable.</p>
  <p>How can I read the <code>TextInput</code> value without using <code>useState</code> and <code>onChangeText</code>?</p>