Skip to content

Commit

Permalink
test react router
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenGrider committed Apr 13, 2017
1 parent c584c6e commit 73f23bc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"react": "^0.14.3",
"react-dom": "^0.14.3",
"react-redux": "4.0.0",
"react-router": "^4.0.0",
"react-router-dom": "^4.0.0",
"redux": "^3.0.4"
}
}
17 changes: 16 additions & 1 deletion blog/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,29 @@ import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import { BrowserRouter, Route } from 'react-router-dom';

import App from './components/app';
import reducers from './reducers';

const createStoreWithMiddleware = applyMiddleware()(createStore);

class Hello extends React.Component {
render() { return <div>Hello!</div> }
}

class Goodbye extends React.Component {
render() { return <div>Goodbye!</div> }
}

ReactDOM.render(
<Provider store={createStoreWithMiddleware(reducers)}>
<App />
<BrowserRouter>
<div>
Header
<Route path="/hello" component={Hello} />
<Route path="/goodbye" component={Goodbye} />
</div>
</BrowserRouter>
</Provider>
, document.querySelector('.container'));

0 comments on commit 73f23bc

Please sign in to comment.