Skip to content

Instantly share code, notes, and snippets.

@eddyw
Created November 1, 2017 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eddyw/96f6f2e3be8b17ff11484601fcb6f940 to your computer and use it in GitHub Desktop.
Save eddyw/96f6f2e3be8b17ff11484601fcb6f940 to your computer and use it in GitHub Desktop.
Suck less at React (utilities #1): Switch Components
<section>
{
this.props.section === 1 &&
this.props.isUserLogged
? <SectionUserLogged /> :
this.props.section === 1
? <SectionUserNotLogged />
this.props.section === 2 &&
this.props.isUserLogged &&
this.props.isUserAdmin
? <SectionDashboard />
: null
}
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment