Created
April 4, 2020 08:10
-
-
Save JanBussieck/b58d604691d89c98524a109719c0605c to your computer and use it in GitHub Desktop.
Wrapping redux in a hook
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 useBook = (id) => { | |
const book = useSelector(getBook(id)); | |
const dispatch = useDispatch(); | |
const update = (...args) => dispatch(updateAction(id, ...args)); | |
return [book, update]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment