title: how can i get a value from a child component to parent screen in react native?
body: <p>hi i am new to react native... my problem is, how can we catch a value set in child-component from the parent screen? here is a sample code (the parent and child are in different source_files).. how can i read the value in variable <strong>count</strong> from the ParentScreen? when the <strong>Count++</strong> button is clicked in the child-control, the <strong>txtFromChild</strong> variable needs to be updated.. how can we do it?</p>
  <pre><code>ParentScreen.js
  
  const ParentScreen= () =&gt; {     
      const [txtFromChild, setTextFromChild ) = useState('');         
  
      return (
          &lt;View&gt;
          &lt;Text&gt;{txtFromChild}&lt;/Text&gt;
          &lt;ChildControl /&gt;
          &lt;/View&gt;    
      );    
  };    
  export default ParentScreen;
  </code></pre>
  <p>and this is the child control in seperate file</p>
  <pre><code>ChildControl.js
      const ChildControl= () =&gt; {     
      const [count, setCount ) = useState(0);       
  
      return (
          &lt;View&gt;
          &lt;Button title=&quot;Count++&quot; onPress={()=&gt;{setCount(count+1)}}/&gt;
          &lt;/View&gt;    
      );    
  };    
  export default ChildControl;
  </code></pre>