Skip to content
This repository has been archived by the owner on Jul 31, 2018. It is now read-only.

Commit

Permalink
Merge pull request #24 from lenaten/master
Browse files Browse the repository at this point in the history
add react-router support by redux-simple-router. close #2
  • Loading branch information
tj committed Jan 1, 2016
2 parents c0a38cf + 013ed86 commit 009dbea
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
3 changes: 1 addition & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ A boilerplate of things that mostly shouldn't exist.
- [x] [PostCSS](https://github.com/postcss/postcss)
- [x] [CSS modules](https://github.com/outpunk/postcss-modules)
- [x] [Rucksack](http://simplaio.github.io/rucksack/docs)
- [x] Hot reloading
- [ ] Redux router
- [x] [Redux router](https://github.com/rackt/redux-simple-router)
- [ ] Redux effects
- [x] TodoMVC example

Expand Down
3 changes: 2 additions & 1 deletion client/containers/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import style from './style.css'

class App extends Component {
render() {
const { todos, actions } = this.props
const { todos, actions, children } = this.props
return (
<div className={style.normal}>
<Header addTodo={actions.addTodo} />
<MainSection todos={todos} actions={actions} />
{children}
</div>
)
}
Expand Down
16 changes: 12 additions & 4 deletions client/index.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@

import { Provider } from 'react-redux'
import { createStore } from 'redux'
import ReactDOM from "react-dom"
import React from "react"
import { Router, Route } from 'react-router'
import { createHistory } from 'history'
import { syncReduxAndRouter } from 'redux-simple-router'
import ReactDOM from 'react-dom'
import React from 'react'

import App from './containers/App'
import configure from './store'

const store = configure()
const history = createHistory()

syncReduxAndRouter(history, store)

ReactDOM.render(
<Provider store={store}>
<App />
<Router history={history}>
<Route path="/" component={App}>
</Route>
</Router>
</Provider>,
document.getElementById('root')
)
2 changes: 2 additions & 0 deletions client/reducers/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@

import { combineReducers } from 'redux'
import { routeReducer as routing } from 'redux-simple-router'
import todos from './todos'

export default combineReducers({
routing,
todos
})
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack-dev-server --hot --inline --progress --colors --port 3000",
"start": "webpack-dev-server --history-api-fallback --hot --inline --progress --colors --port 3000",
"build": "NODE_ENV=production webpack --progress --colors"
},
"license": "MIT",
Expand All @@ -30,11 +30,14 @@
"dependencies": {
"babel-runtime": "^6.3.19",
"classnames": "^2.1.2",
"history": "^1.17.0",
"react": "^0.14.0",
"react-dom": "^0.14.0",
"react-hot-loader": "^1.3.0",
"react-redux": "^3.1.0",
"react-router": "^1.0.3",
"redux": "^3.0.2",
"redux-actions": "^0.9.0"
"redux-actions": "^0.9.0",
"redux-simple-router": "^1.0.2"
}
}

0 comments on commit 009dbea

Please sign in to comment.