title: multiple expressions in ternary operator with react route
body: <p>Hey i want to set a session item on my route so i can use it on my authentication callback. So here i have a ternary operator and i check if the it is authenticated then i do something and if not i do two things.</p>
  
  <p>it is not working. my question is how to do multiple things on ternary operator whether if it is true or false.</p>
  
  <pre><code>&lt;Route path="/dashboard" render={(props) =&gt; (
            auth.isAuthenticated() ? (
                &lt;whateverComp auth={auth} {...props} /&gt;
            ) : (
                &lt;Redirect to="/log-in"/&gt;
            ) ? // setter for page_name
                sessionStorage.setItem('page_name', 'dashboard'): null
        )}/&gt;
  </code></pre>
  
  <p>My solution for this :</p>
  
  <pre><code>&lt;Route path="/dashboard" render={(props) =&gt; {
          if (!auth.isAuthenticated()) {
            sessionStorage.setItem('page_name', 'dashboard');
            return &lt;Redirect to="/log-in"/&gt;;
          }
          else {
            return &lt;Dashboard auth={auth} {...props} /&gt;;
          }
        }}/&gt;
  </code></pre>