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

1988 questions
0
votes
1 answer

React production using react-app-rewired nginx

I have tried to deploy my app on heroku and it work normally. But when I build my app using react-app-rewired script and deploy it to my server using nginx. When access my app, it still work fine but if I reload page with contextPath:…
Duc Anh Pham
  • 71
  • 1
  • 9
0
votes
0 answers

using PrivateRoute in React

In this code, authed state becomes true when the user logs in, but auth used in privateRoute does not become true according to the below code. checkauth() { this.setState({ authed:true }) } render() { function PrivateRoute ({component:…
Sandz
  • 99
  • 3
  • 12
0
votes
1 answer

how to render in react when you depend on async methods

I'm new to react, but I advanced a little and I'm facing an issue where I don't know how to express what I want in my code: I have a "proxy" over my routes that saves info from the url to the apollo cache function saveUrlVarsToCache(props) { …
Zied Hamdi
  • 2,400
  • 1
  • 25
  • 40
0
votes
1 answer

How to recognize if the route was initiated through a history.push or a manual adress change (react-router)

I have the browser cache as the central single source of truth. When I want to change the app state, I just change the broser cache and call setState to trigger a render(). Everything works fine unless the user changes the adress manually…
Zied Hamdi
  • 2,400
  • 1
  • 25
  • 40
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
  • 749
  • 6
  • 29
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
  • 983
  • 1
  • 13
  • 47
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,413
  • 2
  • 19
  • 29
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
  • 2,193
  • 4
  • 23
  • 37
0
votes
1 answer

Route does not render component on 2nd level of children

In App.js In Dashboard.js
Huy Nguyen
  • 520
  • 2
  • 7
  • 20
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
  • 141
  • 1
  • 15
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,719
  • 7
  • 21
  • 40
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,701
  • 8
  • 47
  • 76
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
  • 3,522
  • 8
  • 33
  • 86
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…
TheAmplifier
  • 82
  • 10
1 2 3
99
100