Then, we are going to adjust the Logout component to use both the useUserState and the useDispatch Hooks with the following steps:
- Edit src/user/Logout.js and import the useUserState and useDispatch Hooks:
import { useDispatch, useUserState } from '../hooks'
- Then, replace the current Hook definitions with the following:
const dispatch = useDispatch()
const user = useUserState()
Now the Logout component makes use of our custom Hooks instead of directly accessing the user state and the dispatch function.