Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // define ADD, addMessage(), messageReducer(), and store here:
- const ADD = 'ADD';
- const addMessage = (message) => {
- return {
- type: ADD,
- message
- }
- }
- const messageReducer = (state, action) => {
- switch(action.type) {
- case ADD:
- return [...state, action.message]
- default:
- return state
- }
- }
- const store = Redux.createStore(messageReducer, []);
Add Comment
Please, Sign In to add comment