|
|
|
|
|
by thatswrong0
2405 days ago
|
|
There are "perfectly good reasons" in the sense that if you artificially limit yourself to using the React component tree to manage routes, yes it makes sense how they arrived at this solution. But after dealing with it for a while, it's just so obviously not the correct approach, and it's crazy to me that it's the defacto router. Cargo culting at its finest. The router could exist outside of or at a higher level than the component tree. |
|
I'm not sure I see how obvious it is that a <Redirect/> is wrong. But that's fine, I take your point that it's not particularly intuitive.
I'm of the opinion that routing, in general, is a function of application state - and I like to manage my application state with Redux - so I will often also mix in connected-react-router [1]. This lets you do navigation w/ an imperative API [2].
[0] https://github.com/ReactTraining/react-router/tree/master/pa...
[1] https://github.com/supasate/connected-react-router
[2] https://github.com/supasate/connected-react-router/blob/mast...