title: State in react is behind by one click?
body: <p>Hi guys I was stuck on a problem with state being behind a click. I'm creating an input where users can type the name of the item they want and the handleChange function would filter the original items array for titles that match whatever is in the input value. I searched up a couple stack overflow questions that were similar to this problem and they suggested console.logging in useEffects but when I do that, it's still one click behind. Any suggestions?</p>
  <p>the functionality:</p>
  <pre><code> const handleChange = (e) =&gt; {
      const results = []
      setValue(e.target.value)
  
      for (let item of items) {
        if (item.includes(value)) {
          results.push(item)
        }
      }
      setNewItems(results)
    }
  
  
    useEffect(() =&gt; {
      console.log(newItems)
    }, [newItems])
  </code></pre>
  <p>the component:</p>
  <pre><code>&lt;input
     onChange={handleChange}
     value={value}
  /&gt;
  </code></pre>