Last active
August 1, 2021 09:08
-
-
Save narennaik/52cba102933951b5c24b8ca4c7672842 to your computer and use it in GitHub Desktop.
update the state with the change
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const state = {}; | |
const subscribe = (listener) => { | |
listeners.push(listener); | |
}; | |
const dispatch = (action/change) => { | |
const newState = getNewState(state, action); | |
state = newState; | |
}; | |
const action = { type: 'ADD_TODO', change: 'Go to the cafe' }; | |
dispatch(action) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment