Created
June 16, 2015 15:34
-
-
Save ajaybeniwal/bb2abd9d0c2ced90d3bd to your computer and use it in GitHub Desktop.
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
import React,{Component} from 'react'; | |
import { createRedux } from 'redux'; | |
import Router from './router'; | |
import { Provider } from 'redux/react'; | |
import * as stores from './indexstore'; | |
const redux = createRedux(stores); | |
export default class App extends Component { | |
constructor(props){ | |
super(props); | |
this.state={Handler: null}; | |
} | |
componentDidMount () { | |
Router.run((Handler, state) => | |
this.setState({ Handler }) | |
) | |
} | |
render () { | |
var { Handler } = this.state; | |
return( | |
<Provider redux={redux}> | |
{() => | |
Handler ? <Handler/> : null | |
} | |
</Provider> | |
) | |
} | |
} |
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
import React,{Component} from 'react'; | |
import { RouteHandler,Link } from 'react-router'; | |
export default class MainApp{ | |
render() { | |
return ( | |
<div className='App'> | |
<h1>Hello</h1> | |
<Link to="/login">Login</Link> | |
<div> | |
<RouteHandler {...this.props} /> | |
</div> | |
</div> | |
); | |
} | |
} |
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
import React from 'react'; | |
import { Route } from 'react-router'; | |
import MainApp from './MainApp'; | |
import Login from './Default' | |
export default ( | |
<Route name='explore' path='/' handler={MainApp}> | |
<Route name='login' path='/login' handler={Login}/> | |
</Route> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment