title: How to render stateHook result from the function call in ReactJS
body: <p>I'm trying to get the result of stateHook and render it properly</p>
  <pre><code>//import React from 'react';
  import React, {useState,useEffect} from 'react';
  import {DashboardLayout} from '../components/Layout';
  
  const ProjectsPage = () =&gt; {
  
      function GetCount() {
          const [count, setCount] = useState(0);
  
          useEffect(() =&gt; {
              document.title = `You clicked ${count} times`;
          });
  
          return (
              &lt;div&gt;
                  &lt;p&gt;You clicked {count} times&lt;/p&gt;
                  &lt;button onClick={() =&gt; setCount(count + 1)}&gt;
                      Click me
                  &lt;/button&gt;
              &lt;/div&gt;
  
  
          );
      }
  
      return (
          &lt;DashboardLayout&gt;
              &lt;h2&gt;Projects Page {GetCount}&lt;/h2&gt;
          &lt;/DashboardLayout&gt;
      )
  }
  
  export default ProjectsPage;
  </code></pre>
  <p>While rendering a function call in ReactJS it throws this error</p>
  <pre><code>Warning: Functions are not valid as a React child. This may happen if you return a Component instead of &lt;Component /&gt; from render. Or maybe you meant to call this function rather than return it.
      at h2
      at div
      at section
      at main
      at div
      at div
      at main
      at div
      at BodyWrapper (http://localhost:3000/static/js/main.chunk.js:210:3)
      at DashboardLayout (http://localhost:3000/static/js/main.chunk.js:338:3)
      at ProjectsPage
      at Route (http://localhost:3000/static/js/vendors~main.chunk.js:39794:29)
      at Switch (http://localhost:3000/static/js/vendors~main.chunk.js:39996:29)
      at Router (http://localhost:3000/static/js/vendors~main.chunk.js:39429:30)
      at BrowserRouter (http://localhost:3000/static/js/vendors~main.chunk.js:39049:35)
      at Routes
      at App
  </code></pre>
  <p>And the UI remains blank,</p>