DEV Community

Shaique Hossain
Shaique Hossain

Posted on

React Redux Hooks: useSelector and useDispatch

In React Redux hooks, useSelector and useDispatch are hooks for accessing the Redux store in functional components.

- useSelector: Extracts data from the Redux state using a selector function. It subscribes to the store, re-rendering the component when selected data changes.

- useDispatch: Returns the dispatch function to trigger actions that modify the state. It allows you to send actions to the Redux store from within your component.

Together, they enable functional components to interact with the Redux store seamlessly, replacing the older connect function.

Top comments (0)