Created
December 28, 2019 21:44
-
-
Save shanebdavis/688dcad8df2bfb8aeb72dcb212c61456 to your computer and use it in GitHub Desktop.
modular-redux-tutorial list part 3 - exports
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
// EXPORTS | |
export const useList = () => { | |
const [state, setState] = useState(getState()); | |
useLayoutEffect(() => subscribe(setState), [setState]); | |
return state; | |
}; | |
export const addItem = item => | |
store.dispatch({ type: "addItem", payload: item }); | |
export const deleteItem = item => | |
store.dispatch({ type: "deleteItem", payload: item }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment