Answer the question
In order to leave comments, you need to log in
How to setup react route and navlink properly?
Good day. Please tell me what am I doing wrong.
Created a project with create-react-app using react router.
Locally everything works fine and switches as it should.
configured like this
<Switch>
<Route path="/" exact component={Home} />
<Route path="/messages" component={Messages} />
<Route path="/notification" component={Notification} />
<Route path="/settings" component={Settings} />
</Switch>
<NavLink to="/">Link</NavLink>
<NavLink to="/messages">Link</NavLink>
<NavLink to="/notification">Link</NavLink>
<NavLink to="/settings">Link</NavLink>
<Route path="" exact component={Home} />
then the Home component is loaded, but other links stop working 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