Redux middleware in a Reason world

reasonreact

#1

I’m pondering introducing Reason to a React/Redux project or two, and am very curious about the Redux middleware story. I take it that Reason doesn’t support generators, so Redux-saga is out of the question, and, anyway, maybe something along the lines of Redux-cycles is a better functional approach?

And if not Redux, then what? Does anyone have a story of successfully handling a reasonably large state in a ReasonReact app?


#2

@hoichi wondering the same, any idea?


#3

IDK, still pondering. Maybe I should just go ahead and experiment, but a) I’m somewhat strapped for time these days and b) a small experiment won’t tell how well does this thing scale and how it all composes. Maybe fetches inside hooks actually compose better (and prop drilling is not such a big problem in ReasonReact).

I find it slightly weird that neither Resorative nor React-Reductive adress data fetching. All the more weird since the React team is actively busy with Suspence for data fetching, thus admitting that it’s a use case almost every React dev cares about. But maybe Suspence will change everything, including global state solutions.

Incidentally, the only reducer-based thing I’ve met that does address data fetching somewhat is reason-react-update that recreates the old class-based API via a hook. Not sure yet if I like it (again, I need to see how it works at a scale, and my dayjob has nothing to do with Reason (yet)), but it does resemble the Elm architecture, where reducers can return effects as well.


#4

Did you discover anything of note during your experimentation?


#5

I didn’t experiment much, so no ) Right now my time is divided between TypeScript (at my dayjob) and Elm (pet).