State Management · Junior · Question 30 of 75
What are useSelector and useDispatch for?
- ✓Correct answer: Reading data from the store and getting the
dispatchfunction - 2Selecting a DOM element and dispatching a DOM event
- 3Creating a local store for one component
Explanation
const count = useSelector(state => state.counter.value) re-renders the component only when the selected value changes. const dispatch = useDispatch(); dispatch(increment()) sends an action.