react-router-dom Link doesn't go to page content

126
July 25, 2021, at 4:30 PM

React router dom doesn't work when I use in Nav.Link (Reactstrap). It goes to /register path but content doesn't display

<Nav.Link className="active"><Link to="/register" className="btn btn-dark btn-lg">Register</Link></Nav.Link>

path :

<Router>
  <Switch>
    <Route path="/register" render={({ history }) => <Register />} />
  </Switch>
</Router>
Answer 1

You shouldn't mix Nav.Link's href with React Router's to.

Here are two different solutions:

  1. Import NavLink from Reactstrap and set the prop tag as React Router's NavLink
import { NavLink as RRNavLink } from 'react-router-dom';
import { NavLink } from 'reactstrap';
<NavLink tag={RRNavLink} to="/register" className="btn btn-dark btn-lg">Register</NavLink>
  1. Import NavLink from React Router and add the Reactstrap classes manually
<NavItem>
  <NavLink to="/register" className="btn btn-dark btn-lg">Register</NavLink>
</NavItem>
Rent Charter Buses Company
READ ALSO
I don&#39;t really understand the purpose of brackets enclosing code

I don't really understand the purpose of brackets enclosing code

I'm just playing with integer arrays and find that the following won't compile with multiple errors:

113
I need to obtain the greater of the two counts obtained by calculating rows with particular words in them

I need to obtain the greater of the two counts obtained by calculating rows with particular words in them

From a table named 'review', I want to find the maximum count among the two conditions

107
How to correctly merge multiple csv files in Python

How to correctly merge multiple csv files in Python

How can I correctly merge multiple csv files with, in most cases, different column names between each file? I have tried usingconcat() in the following code:

199
Embed svg in safari doesn&#39;t able to call the click event in safari browser

Embed svg in safari doesn't able to call the click event in safari browser

Embed svg in safari doesn't able to call the click event in safari browser

135