Skip to content

Instantly share code, notes, and snippets.

@JanBussieck
Created April 4, 2020 08:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JanBussieck/b58d604691d89c98524a109719c0605c to your computer and use it in GitHub Desktop.
Save JanBussieck/b58d604691d89c98524a109719c0605c to your computer and use it in GitHub Desktop.
Wrapping redux in a hook
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