Last active
June 30, 2020 22:26
-
-
Save hosseinmd/7c1bacaf1768391c9005d0f8443346c7 to your computer and use it in GitHub Desktop.
example of react-global-hook actions
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 actions = ({ setState, getState }) => { | |
increase(store) { | |
const { counter } = getState(); | |
setState({ | |
counter: counter + 1 | |
}); | |
}, | |
decrease(store) { | |
const { counter } = getState(); | |
setState({ | |
counter: counter - 1 | |
}); | |
} | |
}; | |
export default actions; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment