In Redux Toolkit, the useSelector and useDispatch hook from React-Redux allows you to read data and dispatch actions of a specific slice of the Redux store inside a React component.
Import the useSelector or useDispatch hook from react-redux.
Use it inside your component to access the slice’s state or dispatch from event handlers and functions.
Reference the slice key you defined in configureStore() (e.g., state.counter.value, dipatch(increment())).