title: Store/ Save boolean values in AsyncStorage in react native
body: <p>I need to store boolean values in AsyncStorage in react native application. The value stored will be used in all over the application. Actually, the user will set a variable to true or false in the settings page and based on that value, i make some changes in other pages in the application.</p>
  
  <p>here is the code i'm using
  Settings Page (set value to true or false but the default value is true)</p>
  
  <pre><code>    constructor(props) {
                  super(props);
                  this.state ={
                      status: true
                  }
              };
  
        toggleStatus(){
                  this.setState({
                      status:!this.state.status
                  });
  
   // AsyncStorage.setItem('myCheckbox',JSON.stringify(this.state.status));
  
  //I even hardcoded the value stored and set it to false but it didn't work 
         AsyncStorage.setItem('myCheckbox',  JSON.stringify(false));
                      }
          .. 
          &lt;TouchableOpacity onPress={this.toggleStatus.bind(this)}&gt;
              &lt;Text&gt; touch me &lt;/Text&gt;
          &lt;/TouchableOpacity&gt;
  </code></pre>
  
  <p>and in one of the other pages where I'll be using that value stored in the  AsyncStorage: </p>
  
  <pre><code>componentDidMount() {
  
          const value =   AsyncStorage.getItem('myCheckbox', (value) =&gt; {
              JSON.parse(value)
              console.log("my check box value ", value)
          });
  </code></pre>
  
  <p>But I keep getting this in the console : <a href="https://i.stack.imgur.com/oTg6Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oTg6Q.png" alt="enter image description here"></a></p>