DEV Community

Higher Order Reducers with React Hooks

Hunter Chang on June 22, 2019

This post was originally published at codebushi.com When managing React state with the new useReducer hook, you may find that there are commonly r...
Collapse
 
ematipico profile image
Emanuele Stoppa

Why did you call it high order reducer and not factory reducer or high order function?

From what I can see, it's not a real reducer because it doesn't handle state and/or action.

Collapse
 
changoman profile image
Hunter Chang

Hey! I actually got the name from this Redux article: bit.ly/2Yg2Svy

The example they show something similar, a function that returns a reducer. I guess you can call it a reducer factory or just a higher order function that returns a reducer. I just wanted to emphasize that a reducer is being returned.