title: How to use function inside JSX
body: <p>I am currently reading React official website, where I came across this question. React official website states that we can use function code inside JSX. Hence, I tried the following code, but it's not working.</p>
  
  <p>class ABCD extends React.Component {</p>
  
  <pre><code>render() {
      return (
          &lt;div&gt;
              &lt;p&gt;
                  {() =&gt; &lt;div&gt;Hello World &lt;/div&gt;}
              &lt;/p&gt;
          &lt;/div&gt;
      );
  }
  </code></pre>
  
  <p>} </p>
  
  <p>I know, I know, some of you might say see the example given on the React website. I saw it, the example given on the official website involves outside function. I just want to know that can we use function inside JSX independently. </p>
  
  <p>See this link for extra info: <a href="https://reactjs.org/docs/jsx-in-depth.html" rel="nofollow noreferrer">https://reactjs.org/docs/jsx-in-depth.html</a></p>