DEV Community

Mariusz
Mariusz

Posted on • Updated on

React tldr; Redux Now Has Hooks

  • useSelector: Pass in a function that takes the state as an argument and returns a value. Used to get a single value from state. Can act as a replacement for mapStateToProps.
  • useDispatch: returns a reference to the dispatch object. It can act as a replacement for mapDispatchToProps.
  • useStore: returns an instance of the store. Generally not recommended.

Source: https://glennstovall.com/react-hooks-before-and-after/?utm_source=reactdigest&utm_medium=web&utm_campaign=featured

Top comments (0)