Created
September 21, 2017 22:12
-
-
Save gitexec/9cad68fb7da2b3716b1a1d39de50a713 to your computer and use it in GitHub Desktop.
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
import { | |
BrowserRouter as Router, | |
Link, | |
Route, | |
Switch, | |
} from 'react-router-dom'; | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { Provider } from 'react-redux'; | |
import { createStore, applyMiddleware } from 'redux'; | |
import reducers from './Reducers/ReducersContainer'; | |
export class Home extends React.Component<{}, {}>{ | |
render() { | |
return <h1>Home</h1>; | |
} | |
} | |
export class About extends React.Component<{}, {}>{ | |
render() { | |
return <h1>About</h1>; | |
} | |
} | |
const createStoreWithMiddleware = applyMiddleware()(createStore); | |
ReactDOM.render( | |
<Provider store={createStoreWithMiddleware(reducers)}> | |
<Router> | |
<div> | |
<Link to="/">Home</Link>{' '} | |
<Link to={{ pathname: '/about' }}>About</Link>{' '} | |
<Switch> | |
<Route path="/" component={Home} /> | |
<Route path="/about" component={About} /> | |
</Switch> | |
</div> | |
</Router> | |
</Provider>, | |
document.getElementById("react-root") | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment