Skip to content

Commit 12414e5

Browse files
committed
Add redux store
1 parent dcd9468 commit 12414e5

File tree

4 files changed

+472
-535
lines changed

4 files changed

+472
-535
lines changed

app/app.jsx

+9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ var {
99

1010
var TodoApp = require('TodoApp');
1111

12+
var actions = require('actions');
13+
var store = require('configureStore').configure();
14+
15+
store.subscribe(() => {
16+
console.log('New state', store.getState());
17+
});
18+
19+
store.dispatch(actions.addTodo('Node projects'));
20+
1221
// Load foundation
1322
$(document).foundation();
1423

app/store/configureStore.jsx

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const redux = require('redux');
2+
3+
const {searchTextReducer, showCompletedReducer, todoReducer} = require('reducers');
4+
5+
export var configure = () => {
6+
var reducer = redux.combineReducers({
7+
searchText: searchTextReducer,
8+
showCompleted: showCompletedReducer,
9+
todos: todoReducer
10+
});
11+
12+
var store = redux.createStore(reducer, redux.compose(
13+
window.devToolsExtension ? window.devToolsExtension() : f => f
14+
));
15+
16+
return store;
17+
};

public/bundle.js

+444-534
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webpack.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ module.exports = {
2929
alias: {
3030
applicationStyles: 'app/styles/app.scss',
3131
actions: 'app/actions/actions.jsx',
32-
reducers: 'app/reducers/reducers.jsx'
32+
reducers: 'app/reducers/reducers.jsx',
33+
configureStore: 'app/store/configureStore.jsx'
3334
},
3435
extensions: ['','.js', '.jsx']
3536
},

0 commit comments

Comments
 (0)