title: object returning old state
body: <p>I want to return current state in function, which is returning object. </p>
  
  <pre><code>
  myFunction = () =&gt; {
          return (
              myObject = {
                  object: this.state.variable
              }
          )
      }
  </code></pre>
  
  <pre><code>render() {
     return (
  
      &lt;TouchableOpacity
         onPress={() =&gt; {this.setState({ variable: 2 }),  () =&gt; console.log(myFunction())}&gt;
  
      &lt;/TouchableOpacity&gt; )                   
  }
  
  </code></pre>
  
  <p>Function is returning state, which was default. I want to return new state, which was setted.</p>