title: Usage of State in functional component of React
body: <p>How to use State in functional component of React ?</p>
  <p>I have a component like below</p>
  <pre><code>import React, { useState } from 'react';
  
  function App() {
    const [count] = React.useState(0);    //Set State here
  
    function count_checkbox() {
      var applicable = [];
      const cbs = document.querySelectorAll('input[class*=&quot;checkbox_value&quot;]');
      cbs.forEach((cb) =&gt; {
        if (cb.checked) {
          applicable.push(parseInt(cb.value));
        }
      });
      this.setState({ count: applicable.length })  //Update State here
    }
  
    return (
      &lt;div className=&quot;App&quot;&gt;
          &lt;input type=&quot;submit&quot; id=&quot;button&quot; value=&quot;{ this.state.count }&quot;/&gt;   //Use State here
      &lt;/div&gt;
    );
  }
  
  export default App;
  </code></pre>
  <p>But State is not working here.</p>