title: How to add navigation.navigate reactnative
body: <p><strong>Navigation function</strong></p>
  <p>Im using this bit of code to logout user but it doesnt navigate to onboarding screen</p>
  <pre><code>class DrawerItem extends React.Component {
    logout = () =&gt; {
      api
        .logoutUser()
        .then((response) =&gt; {
          if (response.ok) {
            
            this.props.navigation.navigate('Onboarding')
          } else {
            Alert.alert('Not logged in')
          }
        })
        .catch((error) =&gt; {
          //Error
          console.error(error)
        })
    }
  }
  </code></pre>
  <p>why does the above code raise
  <code>ReferenceError: Can't find variable: navigation</code>
  how can i correct it to navigate to the onboarding screen?</p>