Last active
September 8, 2020 13:19
-
-
Save perjo927/59c286f828307196d59a1a145273e25b to your computer and use it in GitHub Desktop.
Make state handlers
This file contains hidden or 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
export const makeStateHandlers = (stateContainer) => ({ | |
getState() { | |
const [lastState] = stateContainer.slice(-1); | |
return lastState; | |
}, | |
setState(newState) { | |
return stateContainer.push(newState); | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment