Using the global state Hooks

Similarly to what we did with the ThemeContext, we can also replace our state Context Hooks with the usePostsStateuseUserState, and useDispatch Hooks. This is optimal if we want to change the state logic later. For example, if our state grows and we want to use a more sophisticated system such as Redux or MobX, then we can simply adjust the existing Hooks and everything will work the same way as before.

In this section, we are going to adjust the following components:

  • UserBar
  • Login
  • Register
  • Logout
  • CreatePost
  • PostList
..................Content has been hidden....................

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