Questions tagged [react-router-component]
110 questions
34
votes
2 answers
How to generate sitemap with react router
I'm trying to figure out how to dynamically generate sitemap in reactJS server side (express) web app. I'm using react router.

Jan Omacka
- 1,810
- 4
- 20
- 27
21
votes
2 answers
React router v4 not working with Redux
Developing a React application using React router v4. All worked well until I introduced Redux in my app. Since then on click of links to change route the browser url changes but the component corresponding to the route is not getting loaded. It…

Peter
- 10,492
- 21
- 82
- 132
13
votes
4 answers
React Router v4 Animated Transition Example
The animation transition example provided in the v4 docs seems a little convoluted to me, since it depicts fading the same component in and out and adjusting the background color.
I'm trying to apply this technique to a more real-world example of…

dougmacklin
- 2,560
- 10
- 42
- 69
11
votes
7 answers
react-router " Cannot read property 'push' of undefined"
i am quite new to react and react-router.
Problem with react is here that, on some pages of my application react-router is working and some giving error like this: "Cannot read property 'push' of undefined".
i am using react 0.14.1
My routing code…
user6730596
10
votes
2 answers
How to maintain state between routes with React Router?
My application had a tab component with 4 tabs. The content of each tab was set up as a separate component. I'm replacing the tab with 4 different routes. I got rid of the tab and used react-router to set up 4 routes, one for each of the 4…

DFB
- 861
- 10
- 25
7
votes
1 answer
Send both 404 status and redirect to 404 component in react-router
I have a react-router 3.0.0 setup with a NotFound component I'm showing as a fallback:
However this returns a redirect and the google crawler is complaining about soft 404s. Can I both redirect to my NotFound…

paqash
- 2,294
- 1
- 17
- 22
7
votes
2 answers
React: How to prompt for unsaved changes when navigating with react-router-component
Redux state holds flag for unsaved changes, and I want to prompt user when navigating (clicks a Link) if this flag is set. I'm using react-router-component. I didn't find how to do this in documentation.

Tuomas Toivonen
- 21,690
- 47
- 129
- 225
7
votes
1 answer
Invariant Violation: The root route must render a single element error in react-router 2 dynamic routing
I have simple Hello World App with one route no child route or index route. For routing i using plain routes instead of jsx sysntax. Again i am using react-router's dynamic routing to load Hello component with webpack.
My app.jsx file has the…

manas
- 6,119
- 10
- 45
- 56
5
votes
1 answer
Uncaught Error: Invariant Violation: Element type is invalid: Object
I'm tinkering with react-router, tying to implement simple routing. I type my code as written in their example (but without imports) https://github.com/rackt/react-router#whats-it-look-like.
And I get this error in a browser:
Uncaught Error:…

Green
- 28,742
- 61
- 158
- 247
4
votes
2 answers
React Route Component prop
Does anyone know why you will call the component in this way. () => inside the route
enter image description here

Ice_mank
- 410
- 3
- 8
4
votes
1 answer
Passing props to children components with react-router v4
Previously in react-router v3.* I passed props to children components via
React.cloneElement(this.props.children, this.props)
How is this done in react-router v4 with the new API
So far the solution I've come up with is to use the render…

Shadrech
- 453
- 4
- 11
4
votes
4 answers
How to display a Route by default with React-Router
I'm new to React and I would like to develop a Single Page Application, so I'm using react-router four routing.
Below the main.js, where I specify the routes
import React from 'react';
import {Router,Route} from 'react-router';
import {App} from…

fgonzalez
- 3,787
- 7
- 45
- 79
4
votes
2 answers
react-router two way binding of query parameters
suppose I have a route path #/plugin?search=:q, and that query parameter q will be put into my search input box, that's okay. The question is if I change the content of my search input box, how can I make the change reflect in the URL path. Say if I…

Gelin Luo
- 14,035
- 27
- 86
- 139
3
votes
2 answers
Registration Form's onSubmit with Link from React-Router-Dom
What I'm trying to achieve is that I want a user to be able to submit a registration only when they follow the correct guidelines, such as having a minimum of 8 characters, etc. I have a button set up with a Link router:
//CSS
import…

jmsapps
- 388
- 2
- 17
3
votes
1 answer
React router - How to redirect to child component if parent component path is entered in url
I would like to redirect my url for e.g to '/questions/1' when I only write /questions

Bradley Bousoula
- 75
- 1
- 6