Adjusting the Logout component

Then, we are going to adjust the Logout component to use both the useUserState and the useDispatch Hooks with the following steps:

  1. Edit src/user/Logout.js and import the useUserState and useDispatch Hooks:
import { useDispatch, useUserState } from '../hooks'
  1. 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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.22.169