DEV Community

Discussion on: useAxios: React hook for any Axios call

Collapse
 
simplecookie profile image
Marcus

I've done similar. But I don't see any reason for useReducer. useState us sufficient and less clottery, makes it more readable when you don't have to deal with actions.

Collapse
 
kwhitejr profile image
Kevin White

I agree that a baseline implementation is more readable if implemented with useState. The idea here is that the reducer is ready and waiting if a user requires more complex local state management.

Collapse
 
simplecookie profile image
Marcus

Sure but most often this will not be required 😊 it's a form of premature optimisation imo. Although it's not an expensive one.