title: Passing useState as props in typescript
body: <p>Say I have a parent component with two child components:</p>
  
  <pre><code>const Parent = () =&gt; {
     const [myVar, setmyVar] = useState(false)
  
     return (
       &lt;&gt;
         &lt;MyChildComponent1 myVar={myVar} setMyVar={setMyVar} \&gt; 
         &lt;MyChildComponent2 myVar={myVar} \&gt;
       &lt;/&gt;
     )
  }
  </code></pre>
  
  <p>Now how would I go about setting the type correctly in <code>MyChildComponent2</code>?</p>
  
  <p>This is what I've come up with so far:</p>
  
  <pre><code>const MyChildComponent1 = (
    {myVar, setMyVar}: 
    {myVar: boolean, setMyVar: (value: boolean) =&gt; void}) = (...)
  </code></pre>
  
  <p>Is the type for <code>setMyvar</code> correct? Or should it be something else?</p>