Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import createStore from 'redux-zero';
const initialState = { route: '', todoList: [] };
const store = createStore(initialState);
export default store;
import store from './store';
function actionCreator(action) {
return function() {
let state = store.getState();
state = action(state, ...arguments);
store.setState(state);
};
}
...
export const remove = actionCreator((state, id) => {
state.todoList = state.todoList.filter(todo => todo.id !== id);
return state;
});
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment