News for hackers. Stuff that matters.
Re:Practical Front-End Architecture by bern4444 on Tuesday September 21, 2021 @02:06PM (#28607841)
That's the thing. In react, there's no difference between a route and a component (at least with react-router). So you can write logic that applies to a Route and logic that applies to a component the same way and apply it at the appropriate layer.

I don't know how Next.js' filesystem router works, but it seems to perhaps be the cause for this roundabout solution.

You can do middleware in client side routing with react-router similar to how you would with express. That's exactly what hooks are for and you can build your own to enable that functionality at the scope that's needed.

There are no comments on this comment yet.