Questions tagged [react-router-v4]

React Router - A complete routing library for React inspired by Ember's routing system

Introduction

React Router is a powerful routing library built on top of React that helps you add new screens and flows to your application incredibly quickly, all while keeping the URL in sync with what's being displayed on the page.


Docs


Related tags

1983 questions
0
votes
1 answer

Reload ReactJS page in development returns me blank

whenever I click the 'reload' button on my browser during my ReactJS development, my page turns up blank and I have to go back to the base URL and start all over. May I know what I can do to keep some sort of 'history'? I am using React-Router…
AKJ
  • 519
  • 3
  • 18
0
votes
0 answers

Why i can't access route in react after refresh after build create on server?

I have to add routes for front end as "/How-it-works" and for admin end as "Admin/Route-name", with following code it works fine and i can access with refresh as well locally but when i create build and access on server it generate an error. …
hu7sy
  • 855
  • 1
  • 10
  • 29
0
votes
1 answer

React-router, optional url parameter with namspace

I am trying to define a react-router with an optional url parameter prefixed with a namespace. This is an example of such a path: path="authors/:authorId/posts/:postId?" // application.com/authors/8/posts/4 I want the postId variable part to be…
Hoetmaaiers
  • 3,179
  • 2
  • 16
  • 23
0
votes
1 answer

Push to React Router History from Parent Component

I want to control the router component from my application's root level component (which contains the router as a child). class App extends Component { componentDidMount(){ // potentially push to…
Daniel Thompson
  • 1,751
  • 19
  • 32
0
votes
1 answer

Route does not render component on 2nd level of children

In App.js In Dashboard.js
Huy Nguyen
  • 301
  • 1
  • 4
  • 14
0
votes
0 answers

HOC is triggering while I use it on container

Could anyone can help me, because i can't understand why HOC is causing ifnite loop while I am using it on container. That's my container: class UserContainer extends Component { componentDidMount() { const { onValuePassedThroughParams, match…
0
votes
1 answer

React Router modify URL if all params are not passed

I am trying to fix an issue in my app where I need to modify the URL when all route params are not entered in the URL by the user. This is what my router looks like:
Kapil Sharma
  • 111
  • 1
  • 14
0
votes
1 answer

Why React router v4 makes incorrect redirect?

I have a simple React app and I'm trying to implement auth logic. This is how my application looks like: class App extends Component { render() { return (
Nastro
  • 1,330
  • 1
  • 15
  • 32
0
votes
1 answer

React Route v4 and PrivateRoute gives error - React.createElement: type is invalid

Why am I getting this error? Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the…
nasaa
  • 2,421
  • 7
  • 42
  • 71
0
votes
1 answer

React conditional router for Cordova

I'm trying to switch between hash history and browser history for a React app in Cordova. On the web I want to use Browser history, in Cordova I have to use HashHistory I've tried something like import createBrowserHistory from…
beek
  • 2,660
  • 3
  • 22
  • 58
0
votes
1 answer

Meteor with react router v4 - redirect not working

I have two files: route.js and main.js. I created a tracker inside the main.js file where I constantly check the loggedin state. Based on alanning:roles user roles I need to redirect users to a different interface than administrators. But doesn't…
0
votes
0 answers

react router multiple goBack

I have a react app with react-router. I have multiple routes, and some of them are shown in a modal window. If I close the modal, I want to send back the user to the previous page, where modal was not active yet. To know, if I have modal open, I…
0
votes
1 answer

React CSSTransition with Route renders next page first then works with rendering next page again

Starting from the state of that Products is rendered. I want Products above to exit with animation and ProductDetailPhotos to appear when clicking NavLink to={'/product-detail/' + variant.id} which exists in Products view , however, firstly Products…
0
votes
1 answer

TypeError: Cannot read property 'key' of undefined

am trying to do a route system with react and react-pose for animating route and parsing the location object return me an error can you please help me ?? this is the code the error is in the Routecontainer import React, { Component } from…
0
votes
2 answers

How can i pass a component to another component via props

I have this scenario where my web application would have a header with 3 options. Depending on the options selected, the headers will be re-rendered with new options. Since I am new to React, my immediate idea of the code structure would be to have…
AKJ
  • 519
  • 3
  • 18