Last active
December 20, 2017 02:54
-
-
Save adavia/beb2b95f06641ddbb9d98f3d8e6eeef8 to your computer and use it in GitHub Desktop.
HOC Route render
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| return ( | |
| <div> | |
| <Switch location={isModal ? this.prevLocation : location}> | |
| <Route path="/" exact component={withAuth(Main)} /> | |
| <Route path="/auth/register" exact component={Register} /> | |
| <Route path="/auth/login" exact component={Login} /> | |
| <Route path="/users" exact component={withAuth(ListUsers)} /> | |
| <Route | |
| path='/clients/:id/edit' | |
| render={() => withAuth( | |
| <div> | |
| {isModal ? null : <Main />} | |
| <ClientEdit onClose={() => this.props.history.push('/')} /> | |
| </div> | |
| )} | |
| /> | |
| </Switch> | |
| {isModal ? | |
| <Route | |
| path='/clients/new' | |
| component={withAuth(ClientNew)} | |
| /> | |
| : null} | |
| {isModal ? | |
| <Route | |
| path='/clients/:id/edit' | |
| component={withAuth(ClientEdit)} | |
| /> | |
| : null} | |
| </div> | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment