Access State with the Redux useSelector Hook

InstructorJamund Ferguson

Share this video with your friends

Send Tweet

Redux has greatly simplified the pattern used to access state from its store. We now use the useSelector hook.

This hook takes as its main argument a function that receives the entire redux state and returns a single part of that state. It looks like this.

const amount = useSelector(state => state.amount);

Components using this hook will be re-rendered any time the returned value changes (either the value itself, or its reference in the case of objects and arrays).

Learn more about this hook here: https://react-redux.js.org/api/hooks