title: "useState" cannot be called inside a callback. How to use state on "useCallback"?
body: <p>I want to update state in Child component but it doesn't work. Actually, there're a lot of items. And I want to list each item with <code>map</code>.</p>
  
  <p>The error:</p>
  
  <blockquote>
    <p>React Hook "useState" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function</p>
  </blockquote>
  
  <p>The code:</p>
  
  <pre><code>const renderItems = useCallback(() =&gt; {
    return items.map((item, idx) =&gt; {
      const { name } = room
      const [isCopiedURL, setIsCopiedURL] = useState(false)
  
      return (
        &lt;li key={idx}&gt;
          &lt;CopyToClipboard
            text={item.name}
            onCopy={() =&gt; setIsCopiedURL(true)}
          &gt;
            {item.name}
          &lt;/CopyToClipboard&gt;
        &lt;/li&gt;
      )
    })
  }, [items])
  </code></pre>