7 Matching Annotations
  1. Oct 2020
    1. A first step would be to dispatch actions and update state via a reducer, something along the lines of useReducer in React.
  2. Oct 2019
  3. Aug 2019
    1. I’m here to convince you that when wrapped in a 4 line custom hook, useState can be just as powerful as, if not more powerful than, useReducer when managing complex state.
    1. So far, we have used various state hooks to manage our data fetching state for the data, loading and error state. However, somehow all these states, managed with their own state hook, belong together because they care about the same cause. As you can see, they are all used within the data fetching function. A good indicator that they belong together is that they are used one after another (e.g. setIsError, setIsLoading). Let's combine all three of them with a Reducer Hook instead.