7 ms·
This is an anti-pattern unless you actually have shared state between pages. Otherwise it's functionally no different to just having local state on each page an
by BigJono 10y ago
This is an anti-pattern unless you actually have shared state between pages. Otherwise it's functionally no different to just having local state on each page and all you have is lots of unnecessary boilerplate.
This is way more common than I realised before I started working in teams. Each page does it's own API calls to the server (either directly, or more commonly through some sort of horrible misuse of redux-thunk), stores the data in it's own little section of the redux store, and then receives the exact same data back as props :/
- fraserharris 10y agoIn general, you only need react-router if you have multiple pages with some kind of shared state (ie: a dashboard). I do know exactly what you are talking about. We do have some single pages that implement the boiler plate just so that they are consistent with the others.