title: How to use throttle or debounce with React Hook?
body: <p>I'm trying to use the <code>throttle</code> method from <code>lodash</code> in a functional component, e.g.:</p>
  
  <pre><code>const App = () =&gt; {
    const [value, setValue] = useState(0)
    useEffect(throttle(() =&gt; console.log(value), 1000), [value])
    return (
      &lt;button onClick={() =&gt; setValue(value + 1)}&gt;{value}&lt;/button&gt;
    )
  }
  </code></pre>
  
  <p>Since the method inside <code>useEffect</code> is redeclared at each render, the throttling effect does not work.</p>
  
  <p>Does anyone have a simple solution ?</p>