Why is it that react-router is a React Component and uses react internally? I mean the problem of routing was solved before React Components came to the scene?
Does the Route component's render method return null if the path property does not match the url path?
Is using the Router and Route components from react-router just a nice design pattern?
The goal of React is to make your views declarative: you don't manage the transitions, just how things should be. So it makes sense to have a react component select the right view based on the current url and manage all this stuff itself.
And that's react-router.
The <Router> component is there to say "this part of the tree is controlled by react-router" and then you select what url match which components via <Route path="/" /><YourComponent/></Route>
The alternative would be to synchronize yourself the state of the app with the url and that's what people did before. like: window.onhashchange = updateTitle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With