Skip to content

antwonthegreat/polymer3-workout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Redux workflow

1 - Define your reducer

const initialState = {
    todos: []
};

const todoReducer = (state, action) => {
    switch (action.type) {
        case 'ADD': {
            return {...state, todos: [...state.todos, action.payload]}
        }
        default: {
            return initialState;
        }
    }
};

export {todoReducer};

2 - Create your store

import {createStore, combineReducers} from 'redux';
import {todoReducer} from "./reducers/todo-reducer";

const reducers = combineReducers({
    todoReducer
});

const store = createStore(reducers);

export { store };

3 - Listen to your store

store.subscribe

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published