title: How do i setState onClick
body: <p>Hi so i got my react function with a state that i use to know which componont should be rendered at a given time; here is my main App Function (i only include the function not the rest of class since it is not relevent)</p>
  <p>My app function</p>
  <pre><code>function App(){
    const [menuState, setMenuState] = useState('journal');
    
    return(
      &lt;&gt;
        &lt;button onClick={setMenuState('journal')}&gt;JOUNRAL&lt;/button&gt;
        &lt;button onClick={setMenuState('stats')}&gt;STATS&lt;/button&gt;
        &lt;MenuHandler menu={menuState}/&gt;
      &lt;/&gt;
    );
  }
  </code></pre>
  <p>My MenuHandler function</p>
  <pre><code>function MenuHandler(props) {
    const menu = props.menu;
    if(menu===&quot;journal&quot;)
      return (&lt;Journal /&gt;);
    if(menu===&quot;stats&quot;)
      return (&lt;Stats /&gt;);
    return (&lt;Journal /&gt;);
  }
  </code></pre>
  <p>When i do this i get an infinite loop and i can't figure out why.</p>