title: React JS: doesn't state gets its initial value after rerender?
body: <p>When the state is changed, the function runs again(correct me if I'm wrong). And because first line of App function defines state, the values of data and setData won't be default again?
  For example,</p>
  <pre><code>import { useState } from &quot;react&quot;;
  import './App.css';
  
  function App() {
    let [data, setData] = useState(&quot;string&quot;);
    function update() {
      setData(&quot;changed&quot;)
    }
    return (
      &lt;div className=&quot;App&quot;&gt;
        &lt;h1 onClick={update}&gt;{data}&lt;/h1&gt;
      &lt;/div&gt;
    );
  }
  
  export default App;
  </code></pre>