Questions tagged [react-router-component]

90 questions
27
votes
3 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,630
  • 4
  • 17
  • 26
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…
JS dev
  • 8,456
  • 12
  • 68
  • 111
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,290
  • 9
  • 37
  • 66
9
votes
6 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
9
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…
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
  • 4,872
  • 7
  • 39
  • 50
6
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,142
  • 1
  • 15
  • 22
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
  • 21,978
  • 45
  • 138
  • 223
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
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
  • 353
  • 3
  • 11
4
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
  • 15,414
  • 22
  • 98
  • 170
3
votes
4 answers

React Router master-detail: children component don't render new view until page refresh

I am creating a master-detail navigation just like the example here the react router example; I have a container component OneCheckpointContainer, which renders a navigation panel CheckpointNav (the links), and a data component OneCheckpointData…
3
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
  • 13,399
  • 23
  • 77
  • 119
3
votes
1 answer

React Routing gives Unexpected Token Error

I am trying to create routes for my React application with react-router-component. But when I build my project with webpack, I get the error: ERROR in ./app/js/client.jsx Module build failed: Error: Parse Error: Line 22: Unexpected token < The…
CascadiaJS
  • 1,766
  • 2
  • 21
  • 38
3
votes
2 answers

React Router conditioning by Route

I'm using React Router for server side rendering and I'd like to run a special action on certain Route, actually on DefaultRoute. How should I create condition for that? I tried following code: var React = require("react"); var Router =…
1
2 3 4 5 6