title: How to pass data to the render method in react-native
body: <p>I am trying to display something fetched via graphql in my react-native was-amplify mobile app. I can't figure out how to pass that fetched data to my render method. Here's the source code. I need to be able to show the contents of the singletour object inside render. React throws an error when I try to reference this.props.singletour inside the render method. Another thing I can't figure out is how to pass the parameter received by navigation inside render to the GetTournament graphql query. Ideally I want the id: inside GetTournament to contain navigation.getParam('itemId', 'NO-ID') and not the hardcoded id. Again, react throws an error when I access this parameter inside the async method call...ANY help would be greatly appreciated!!</p>
  
  <pre><code> class DetailsScreen extends React.Component {
  
   async componentDidMount() {
    try {
     const graphqldata = await API.graphql(graphqlOperation(GetTournament, { id: "4e00bfe4-6348-47e7-9231-a8b2e722c990" }))
    console.log('graphqldata:', graphqldata)
    this.setState({ singletour: graphqldata.data.getTournament })
    console.log('singletour:', this.state.singletour)
   } catch (err) {
     console.log('error: ', err)
    }
   }
  render() {
  /* 2. Get the param, provide a fallback value if not available */
  const { navigation } = this.props;
  const itemId = navigation.getParam('itemId', 'NO-ID');
  const otherParam = navigation.getParam('otherParam', 'some default value');
  return (
    &lt;View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}&gt;
      &lt;Text&gt;Details Screen&lt;/Text&gt;
      &lt;Text&gt;itemId: {JSON.stringify(itemId)}&lt;/Text&gt;
      &lt;Text&gt;otherParam: {JSON.stringify(otherParam)}&lt;/Text&gt;
  
      &lt;Button
        title="Go to Home"
        onPress={() =&gt; this.props.navigation.navigate('Home')}
      /&gt;
      &lt;Button
        title="Go back"
        onPress={() =&gt; this.props.navigation.goBack()}
      /&gt;
    &lt;/View&gt;
    );
    }
   }
  </code></pre>