CONTACT US

    Redux Now Has Hooks. A Before and After Comparison

    A man dressed as a pirate wears a black hat and eyepatch, and has a hook for a hand. He is shouting with an open mouth, and stands in front of a background with ships and smoke.
    • 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.

    Article link copied

    Close button