title: Print value from variable react-native
body: <p>i am trying to print value of variable 'str' by setting its state. My approach is When the user click the button Print the TextInput value in the Text field. I am getting the value though using console and alert but its not printing in the desired tags</p>
  
  <p>Here's my code </p>
  
  <pre><code>`
  var str="";
  
  class WeatherProject extends Component{
  
    constructor (props) {
      super(props);
      this.state={
          From:'',
          To:''
      }
  
    }
  
   changeText=(From)=&gt;{
     this.setState({From})
  
   }
   onPress = ()=&gt;{
    str= this.state.From
   }
    render(){
  return (
  &lt;View&gt;
      &lt;TextInput placeholder="From" id="from" style={styles.fromField} onChangeText={this.changeText} /&gt; 
      &lt;Button
        title={"Press"}
        color="#f194ff"
        onPress={this.onPress}
        &gt;&lt;/Button&gt;
  
        &lt;Text&gt;{str}&lt;/Text&gt; //Here i need the output via variable str
        &lt;/View&gt;
  
  );
  }
  }
  
  export default WeatherProject 
  </code></pre>
  
  <p>`</p>