title: how to save username and password in cache ? react-native
body: <p><em>I try to save my Username and Password in cache. I couldnt save two data so I try to save just username below code.</em></p>
  
  <p>but when I enter letter to TextInput, data goes to </p>
  
  <blockquote>
    <p>savedata()</p>
  </blockquote>
  
  <p><em>but here, this.setState doesnt work I dont know why. Because when render page,</em> </p>
  
  <blockquote>
    <p>console.log("mykey : ", this.state.mykey );</p>
  </blockquote>
  
  <p><em>gives me empty object</em></p>
  
  <p><strong>here is code</strong></p>
  
  <pre><code>&lt;View style={styles.ChildViewStyle}&gt;
  
      &lt;TextInput
          value = {this.state.mykey}
          placeholder= "Kullanıcı Adı"
          placeholderTextColor="#fff"
          onChangeText={(text) =&gt;  this.savedata(text)}
          keyboardType='email-address'
          onSubmitEditing={() =&gt; this.passwordInput.focus()}
          style={styles.input}
      /&gt;
  
  &lt;/View&gt;
  </code></pre>
  
  <p><strong>here is my methods</strong></p>
  
  <pre><code>savedata = (value) =&gt; {
      AsyncStorage.setItem("myKey", value);
      this.setState({myKey: value});
  
      console.log("deneme",value);
  }
  
  componentDidMount(){
      AsyncStorage.getItem("myKey").then((value) =&gt; {
          this.setState({myKey: value});
          console.log("didmounth : ", value)
      }).done();
  }
  </code></pre>
  
  <p><strong>Also how can I save two value which are username and password ?</strong></p>