Skip to content

Instantly share code, notes, and snippets.

@mjackson
mjackson / nested-ternary-jsx.js
Created November 2, 2016 19:35
Nested ternaries work like if/else if/else for JSX
const element = (
<div>
{currentPage === 'signin' ? (
<SignInPage/>
) : currentPage === 'welcome' ? (
<WelcomePage/>
) : currentPage === 'about' ? (
<AboutPage/>
) : (
<DefaultPage/>