Similarly to what we did with the ThemeContext, we can also replace our state Context Hooks with the usePostsState, useUserState, 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