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
1 answer

How to get previous location with react router?

I'm trying to get the previous location from react router. I've set up a reducer to listen for @@router/LOCATION_CHANGE and store the current and new locations but this action doesn't seem to get fired anymore? Reducer looks like this: const…
GooseZA
  • 891
  • 1
  • 8
  • 13
1
vote
0 answers

Config React BrowserRouter in Google Cloud Engine

I am using Google Cloud Platform's PHP based static server. My public folder contains one landing page and and a web-app. The landing page just is a static html file with few css and image files which resides on root. The web-app is made of React,…
Sivadass N
  • 803
  • 3
  • 12
  • 22
1
vote
1 answer

Exclude API/login urls from router routing

I have a React App which proxies requests to Django, and Django has allauth installed to manage social app login. But my app is SPA which uses react-router, so when I have a link like /accounts/github/login, it seems like it is only passed to…
RomaValcer
  • 2,328
  • 3
  • 15
  • 28
1
vote
1 answer

react-router: unable to route to child components

i am building an online database using react and the routes have been set up such that if user is not authenticated, they will be redirected to the login page. However, i am facing difficulties for the nested routes. i think some parts of the…
jaanhio
  • 733
  • 1
  • 5
  • 14
1
vote
1 answer

How to reroute onClose semantic ui modal

I'm having trouble trying to reroute onClose of a modal from Semantic UI React. For some reason, Redirect to tag from react router dom does not trigger the redirect. Here is the code:
Shaun Chua
  • 537
  • 1
  • 10
  • 24
1
vote
0 answers

React-Router. How to collect the history by Redirect in react-router-dom?

I try to understand what is the correct way to collect the history in surfing around the SPA website in React with react-router-dom. I need to make many redirections inside my app, and it's work good with component of react-router-dom.…
Max Wolfen
  • 1,523
  • 5
  • 15
  • 38
1
vote
0 answers

React - Unable to render Privateroute with react-router-dom

I'm using nodejs with express for the backend and react with react-router-dom for the front and I can't properly navigate through the app. I tried to reuse the example on react-router with PrivateRoute but my Components, once logged in, won't…
1
vote
2 answers

Why in the new react-router-dom does not fire inside the setTimout?

So, I tried to make a little delay between the logout page and redirecting to the main website page. But I fall into the problem, that the react-router-dom method does not want fire when we put it inside the setTimeout() of…
Max Wolfen
  • 1,523
  • 5
  • 15
  • 38
1
vote
0 answers

`formValueSelector` doesn't get the values if I go to the new page via changing URL

I am using Redux-Form 7.3.0 and noticed that if go to other pages via changing the URL then if on the new page if I try to get values with formValueSelector it doesn't work - will be undefined. But if I go to the new page component via
1
vote
1 answer

How can I access the closest 's match inside children?

I'm rendering with ReactDom in an index.js file. ReactDOM.render(
David
  • 199
  • 1
  • 13
1
vote
1 answer

How to access param in parent component with React Router DOM

My routes are like App component is class App extends Component { componentDidMount() { if (this.props.match)…
David
  • 199
  • 1
  • 13
1
vote
1 answer

react-router-dom Link on click close bootstrap modal window

I need to close the modal window by clicking on the link. My modal window: export const ModalWrapper = (props) => { const { children, title, modalName } = props; return (
1
vote
2 answers

react-router-dom route component requires page reload

When calling history.push('/packages') the url is updated but the component will not mount (render) unless the page is reloaded. If I call createHistory({forceRefresh: true}) or manually reload the page the UI is rendered correctly. How can I…
neridaj
  • 1,867
  • 5
  • 25
  • 54
1
vote
1 answer

HashRouter causes Spotify Implicit Grant Flow to fail because callback URL is invalid

I have a HashRouter, which makes the URL add #, resulting in # to be added after the URL callback response_type query parameter. If you change # to %23, it will lead to Invalid redirect URI. How can I combine the use of HashRouter, and the Spotify…
1
vote
1 answer

SO Issue with react-router-dom: "Check the render method of `Header`"

I'm getting an error with react-router-dom "/home" route fails with the error below: Route /home: Route "/about" works fine: Does anyone knows how to solve this problem? This is how my "index.js" file looks like: import React from…
Matías Magni
  • 173
  • 2
  • 16
1 2 3
99
100