Answer the question
In order to leave comments, you need to log in
Why doesn't react router redirect from the address bar, but only from a link in the layout?
A little pain at the beginning : I'm just learning react and I'm already exhausted after every slightest change, then the new version and everything old is not supported and in general you need to download react-router-dom, then the webpack will fall off, or something else. The slightest change and you have to google what the plug is, and in the lessons they don’t talk about the version, which is terribly wrong due to the total changes that occur almost daily. I’m already silent that from lesson to lesson my own style, wrapper and assembly is used, under which it is unrealistic to rebuild every time.
To the point : I have the last node, npm, react and router. I'm doing a lesson from scotch tape: https://scotch.io/tutorials/routing-react-apps-the...
serve works, everything starts in the usual way, Watch catches changes.
I added different fish content components:
class Car extends Component {
render(){
return (<h1>Cars page</h1>);
}
}
<Router>
<div>
<ul>
<li><Link to="/">Home</Link></li>
<li><Link to="/about">About</Link></li>
<li><Link to="/car">Car</Link></li>
</ul>
<Route exact path="/" component={Home}/>
<Route path="/about" component={About}/>
<Route path="/car" component={Car}/>
</div>
</Router>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question