I want to use useReducer instead of useState for data that is updated using useEffect in the codes below because this causes t