Questions tagged [react-router-dom]

Use this tag for questions regarding DOM use and bindings of React Router v4, v5, and v6.

Introduction

React Router DOM is a package that contains all the DOM bindings for React Router. That includes things such as HashRouter and BrowserRouter which are specific to DOM use for the browser.


Docs

Related tags

3682 questions
1
vote
0 answers

How to get individual param from multiple params in react-router-dom?

I want to get and display individual param from multiple params in react-router-dom like in this URL http://localhost/tag/news/local/tour. The URL has three params which is the last two are optional. Here are routes and components: //…
mrale81
  • 77
  • 1
  • 9
1
vote
1 answer

React page returns 404 in iOS WKWebView

I have a react app with the following routes: example.com/ example.com/policy When I try to access example.com/ from my iOS app's WKWebView It is rendering the proper homepage. but when I try to access example.com/policy nginx returns a 404…
1
vote
1 answer

Migrate 'react-router' into 'react-router-dom' (v4)

I am learning React Routing and I am watching this tutorial: https://www.youtube.com/watch?v=1iAG6h9ff5s Its 2016 tutorial so I suppose something changed because 'react-router' not working anymore and I am supposed to use 'react-router-dom'. I found…
1
vote
1 answer

React-router-dom v4 does not render the component

I have a little bit complicated problem (I think so). I am using a React-router-dom v4. I wanted to implement private routes. I have a login page where I call API to authenticate and then when it is successful I redirect my application to another…
1
vote
2 answers

How to implement transition effect for displaying underline on hovering a react router Link?

I am using react-router-dom node package in my react project to implement routing. After setting up the router links,I used following custom CSS to hide the link underline by default: let styles = theme => ({ TextLink: { position:…
1
vote
2 answers

How to force a re-render of React-Redux components upon React-Router-Dom NavLink click?

I have a React application built using React-Router-Dom for navigation. The pages are very heavy on use of tables of data that can be opened in a CRUD form. Due to the amount of records we have in the tables, it's not uncommon for the user to apply…
1
vote
0 answers

Remove query params from url react-router-redux

I am trying to remove query params from url on a user action, using react-router-redux. On user action I am dispatching the following action: dispatch(push({ pathname: url, search: '' }); But this is not removing the query param from url. What…
1
vote
1 answer

React Router Subroutes not showing

I am using react-router-dom for routing within my application. I am having difficulty displaying subroutes. I have 2 routes, localhost:8080/ and localhost:8080/posts/new. The localhost:8080/ route works as intended. If I change the second route to…
1
vote
1 answer

Routes is changing the lookup location of resources

This post is extention to issue in link. The previous problem was solved. Everything was working fine till now when I added this route. I can visit this page via another page in the…
Ladoo
  • 169
  • 7
1
vote
0 answers

React Router v4 dynamic route not able to refresh

I have been searching for a solution on this and have not had any luck. I have a app using the BrowserRouter and has dynamic routes as the user goes deeper into the flow. I have some server side rendering for static routes that work for rendering…
1
vote
0 answers

React Router Error - TypeError: Cannot read property 'func' of undefined

Tried almost everything available on the Internet, and couldn't resolve the problem. When I installed react-router-dom and added Routes and BrowserRouter into my project, I faced this problem: Uncaught TypeError: Cannot read property 'func' of…
user3681549
1
vote
2 answers

React Router Dom Private Route Always Redirects to Login

I’m building a full stack react application. I have the stack operating and pulling information from the backend when I’m calling it from the frontend. I’m using axios on the frontend to hit the endpoints I’ve set up on the backend. I’m having an…
Josh
  • 45
  • 3
  • 9
1
vote
1 answer

Error on accessing property of defined object in React when state is set in componentDidMount

I am trying to figure out how to pass props to a component matching a certain route. As you can see from the code below, every time a user hits /items/:id I get the id from the url and hopefully get the right item accessing the array using that id. …
haunted85
  • 1,501
  • 5
  • 21
  • 40
1
vote
2 answers

Nested route not being rendered

I have: ... MyComponent: return (

Here Some Text

PlayMa256
  • 5,711
  • 1
  • 24
  • 46
1
vote
1 answer

React route working properly when used with but not working when redirected from webpack.config.js

In my react project I am using client side routing using React Router DOM v4. Video link to my problem statement: https://drive.google.com/file/d/1nHY-dKxZvDylF5GQUTK02I8Mam1d5eru/view?usp=sharing I have created the route like this