New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NavLink and React Router - results in complete site reload #298
Comments
I don't think this is in docs yet but you can do the following: Check out the following issue/comment #83 (comment) and look at the docs source code as it uses react router and reactstrap in the same way. |
Thanks eddywashere, not found this before in the docs. Thats works perfectly. |
FYI using I've applied respective class names to |
@pietmichal What'd you have to edit to get TS happy again? |
@eddywashere thank you for proving this working example. |
works for me! ty @eddywashere |
Actually this creates the following html: <li class="nav-item"></li>
<a class="nav-link">Click</a> while it should be <li class="nav-item"><a class="nav-link">Click</a></li> Breaks Bootstrap CSS. |
@levino what creates that HTML? You can post the code here or fork this example and add the code there (save it and send post the link): https://stackblitz.com/edit/reactstrap-v6-xr362c?file=Example.js |
Used Link from react in tag as described in : reactstrap/reactstrap#298
I have updated react bootstrap to web page is loading for every link I have tried |
@sharanagouda I think you mixed up the repositories. What you posted is for https://github.com/react-bootstrap/react-bootstrap |
I made it work like this in next.js
|
This is still not on the docs, and then NavLink behaves diferently from the original one... |
I'm trying to set the |
@endquote Check out the docs for next/link: https://nextjs.org/learn/basics/navigate-between-pages/hoc
It seems like |
Using |
This works perfectly. Doesn't reload the page. Thanks |
This is the perfect answer to this. Please check this out! |
This is good |
Although @eddywashere post got a lot of upvotes I was not able to get it working with:
as I get the following error:
What did work for me was wrapping the
Note the |
Issue description
Hello, i have a problem with the combination of react router and reactstrap. Routing does not work properly when you create a link without the
<Link to="XXX">
method. When I use reactstrap the entirely site reloads its content.reactstrap@4.0.1
react-router@3.0.1
( additionally usereact-router-redux@4.0.7
)NavLink
, maybe others withhref
attributeSteps to reproduce issue
Example:
Resulting html from NavLink (reactstrap) and Link (react-router):
I could use the Link component and add manually the
className="nav-link"
but it would be great if you can provide me a better solution for this problem.Thanks in advance
Dennis
The text was updated successfully, but these errors were encountered: