Skip to content

Instantly share code, notes, and snippets.

@weblogix
Created September 16, 2020 05:57
Show Gist options
  • Save weblogix/9faada4454846b0aacfe646eb52ce2f3 to your computer and use it in GitHub Desktop.
Save weblogix/9faada4454846b0aacfe646eb52ce2f3 to your computer and use it in GitHub Desktop.

Revisions

  1. weblogix created this gist Sep 16, 2020.
    17 changes: 17 additions & 0 deletions multiple_conditionals.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    Source: https://stackoverflow.com/questions/37312122/how-to-do-a-nested-if-else-statement-in-reactjs-jsx

    ```
    this.state.route === 'projects'
    ?
    <div> <Navigation onRouteChange={this.onRouteChange}/> Projects</div>
    :
    this.state.route === 'about'
    ?
    <div> <Navigation onRouteChange={this.onRouteChange}/> About</div>
    :
    this.state.route === 'contact'
    ?
    <div> <Navigation onRouteChange={this.onRouteChange}/> Contact</div>
    :
    <p> default </p>
    ```