Secure routes with RescriptReactRouter

I’m considering using Router | React because it fits my basic needs.

However, I have one requirement: certain routes should require a user to be authenticated. How could I achieve this? I would guess a wrapper component might do the trick, but I’m curious about your approach.

I was looking into using this for a project: Remix Auth | Remix Resources

Absolutely, I can explore a framework to address this. I’m really looking for information on the options available with the simple router included in the ReScript bindings.

1 Like

I currently am going with

It looks great for my needs! Please feel free to let me know if you think any improvements are necessary.

I think it’s a good approach, but you probably don’t want to render children unless auth store is valid as well.

2 Likes

Thanks, that is good thinking indeed.