-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#3087: segregate 'MainRoute' per @webdeveloperpr
- Loading branch information
1 parent
08ab937
commit 66933d6
Showing
3 changed files
with
64 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* main-route.jsx: upper level routes. | ||
* | ||
* Note: this script implements jsx (reactjs) syntax. | ||
* | ||
* Note: importing 'named export' (multiple export statements in a module), | ||
* requires the object being imported, to be surrounded by { brackets }. | ||
* | ||
*/ | ||
|
||
import React, { Component } from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { Route } from 'react-router-dom'; | ||
import LoginLayout from './login.jsx'; | ||
import RegisterLayout from './register.jsx'; | ||
import HomePageState from '../redux/container/home-page.jsx'; | ||
import AnalysisLayoutState from '../redux/container/analysis-layout.jsx'; | ||
|
||
class MainRoute extends Component { | ||
render() { | ||
return ( | ||
<div> | ||
<Route | ||
component={HomePageState} | ||
exact | ||
path='/' | ||
/> | ||
<Route | ||
component={LoginLayout} | ||
exact | ||
path='/login' | ||
/> | ||
<Route | ||
component={LoginLayout} | ||
exact | ||
path='/logout' | ||
/> | ||
<Route | ||
component={RegisterLayout} | ||
exact | ||
path='/register' | ||
/> | ||
<Route | ||
component={AnalysisLayoutState} | ||
path='/session' | ||
/> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
// indicate which class can be exported, and instantiated via 'require' | ||
export default MainRoute; |
This file contains 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
Try wrapping the MemoryRouter with a
<Provider />
component and then pass the props that the /login path requires. You also might want to use shallow render to render only 1 level deep.