title: Same code in terms of localStorage worked in React 17, but doesn't work in React 18
body: <pre><code>const [count, setCount] = useState(0);
  
  useEffect(() =&gt; {
      const savedCount = JSON.parse(localStorage.getItem(&quot;count&quot;));
      setCount(savedCount);
    }, []);
  
    useEffect(() =&gt; {
      localStorage.setItem(&quot;count&quot;, JSON.stringify(count));
    }, [count]);
  </code></pre>
  <p>Saved count in localStorage, and retrieve the saved count every time reload the page. The code works perfectly in React 17.<br />
  Doesn't work in React 18. In React 18, every time I reload the page, count turns back to 0. Any idea?</p>
  <p>Thanks</p>