title: Call a function and pass return value as a prop (ReactJS)
body: <p>I am currently learning React and am working on a project where I'm trying to render a custom Image component. The component is to be rendered on the left or right side of the screen alternating.</p>
  <p>I've set up a handleSide method that just returns a flipped boolean. But I am trying to call that method and pass its return value as a prop:</p>
  <p>handleSide:</p>
  <pre><code>const side = true;
  const handleSide = () =&gt; {
      side = !side;
      return side;
  }; 
  </code></pre>
  <p>In my render():</p>
  <pre><code>&lt;Image side={handleSide} src=&quot;*not including here*&quot;&gt;
  </code></pre>
  <p>How can I get handleSide to be called and then pass the return value in for props.side? Currently it seems to just be calling the method (I think) but not actually passing it as a prop. I also tried something like this:</p>
  <pre><code>&lt;Image side={handleSide} sideBool={side} src=&quot;*not including here*&gt;
  </code></pre>
  <p>Essentially hoping that handleSide would be called and then taking the side's new value and putting it for sideBool. But that didn't seem to work -- every render returned True rather than an alteranting True False. Thanks!</p>