title: Store jsx component inside variables in react-native
body: <p>I am trying to store react-native jsx element inside a variable while printing inside return method but I am getting error like this: <strong>Text strings must be rendered within a  component.</strong> Below is my code in which I am getting error. Any help will be appreciated:  </p>
  
  <pre><code>import { Text, View, Button } from 'react-native';
  import React, { useState } from 'react';
  
  const GameScreen = (props) =&gt; {
  
    const [num, setNum] = useState(0);
    const [randNum, setRandNum] = useState(0);
    const [currentNum, setCurrentNum] = useState('')
    // const [jsxVal, setJsxVal] = useState('')
    let jsxVal = '';
  
    const setRandomNum = (num, min, max) =&gt; {
      const randNum = Math.floor(Math.random() * (max - min)) + min
      setNum(num);
      setRandNum(randNum);
      console.warn("Number is:" + num + " and random number:" + randNum);
    }
  
    const checkNum = (num) =&gt; {
      if (num &lt; randNum) {
        jsxVal = &lt;Text&gt;Your number {num} is lower than {randNum}&lt;/Text&gt;;
        console.warn("if")
      } else if (num === randNum) {
        jsxVal = &lt;Text&gt;Your number {num} is greater than {randNum}&lt;/Text&gt;;
        console.warn("else if")
      } else {
        jsxVal = &lt;Text&gt;Your number {num} is greater than {randNum}&lt;/Text&gt;;
        console.warn("else")
      }
      console.warn("checkNum")
    }
  
    return (
      &lt;View&gt;
        {
          num === 0 ? setRandomNum(props.navigation.getParam('number'), 1, 100) : null
        }
        &lt;Text&gt;Value is :{num}&lt;/Text&gt;
        &lt;View style={{
          justifyContent: 'space-around',
          paddingHorizontal: 8,
          paddingVertical: 8,
          flexDirection: 'row'
        }}&gt;
          &lt;Button title="Lower" onPress={() =&gt; { checkNum(num) }} /&gt;
          &lt;Button title="Greater" onPress={() =&gt; { checkNum(num) }} /&gt;
          {
            jsxVal === '' ? null : jsxVal 
          }
        &lt;/View&gt;
      &lt;/View&gt;
    );
  }
  
  export default GameScreen;
  </code></pre>