How best to combine component props, useReducer and RescriptReactRouter?

Hi all,

I am writing an application in ReScript + React. It manages state using multiple reducers: one at the top level, and a few for self-contained pages underneath that. The top reducer passes some component props down to the lower reducers, which are “linked” to that state using useEffect. So far I have not used a router, and I do not update the history (so linking / back button don’t work).

I’m wondering what the best way is to link multiple reducers together, and how to make browser history / URL linking work. Are there any examples in the wild?

I’m currently using bloodyowl/rescript-react-update and would like to use the built-in RescriptReactRouter.

Usually, you want to convert URL into a domain-specific type on the edge and deal with it within your application. Pretty much the same way you deal with JSON.

This post might be helpful: Safe Routing in ReScript | Alex Fedoseev