I use version:
<div className="topnav">
<NavLink to="/" activeClassName="active" exact={true}>
Home
</NavLink>
<NavLink to="/todo" activeClassName="active" exact={true}>
Todo
</NavLink>
<NavLink to="/about" activeClassName="active">
About
</NavLink>
<a href="/">Home</a>
</div>
<BrowserRouter>
<>
<Navigation />
<img src={logo} className="App-logo" alt="logo" />
<Switch>
<Route path="/" exact>
<Home />
</Route>
<Route path="/todo">
<TodoApp />
</Route>
<Route path="/about">
<About />
</Route>
</Switch>
</>
</BrowserRouter>
With the above application, when I use the <a>
tag it works fine. When I replace it with <Link>
or <NavLink>
, my application only returns the link but does not re-render the application. How to fix it?
Comments
Post a Comment