Skip to content

Instantly share code, notes, and snippets.

@eddyw
Created November 1, 2017 14:48
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/1d89f16d525852689b818ad71e1552ab to your computer and use it in GitHub Desktop.
Save eddyw/1d89f16d525852689b818ad71e1552ab to your computer and use it in GitHub Desktop.
Suck less at React (utilities #1): Switch Components
<section>
<SwitchIf test={this.props.section}>
<SwitchWhen equals={1} render={<Section1 />} />
<SwitchWhen equals={2} render={<Section2 />} />
<SwitchWhen equals={3} render={<Section3 />} />
</SwitchIf>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment