Questions tagged [react-router-component]

110 questions
2
votes
0 answers

Failed to execute 'pushState' on 'History'. Function could not be cloned

On the following very basic project: https://stackblitz.com/edit/react-history-push-with-function-as-arg?file=src%2Fpages%2FPage1.jsx I have the following code: import React from "react"; class Page1 extends React.Component { constructor(props)…
Viewsonic
  • 827
  • 2
  • 15
  • 34
2
votes
2 answers

React routing within another component V6

Im using Reavt V6 route. Im struggeling to get my routes inside gamecomponent to work. visiting /test results in a completly blank page. while it should load crime module within gamecomponent. visiting / renders gamecomponent, but /test does not…
Anetellie
  • 323
  • 1
  • 4
  • 11
2
votes
2 answers

How to use RouterLink with Microsoft FluentUI React Link component

Pretty straight forward. I've seen examples of React Router Link usage on other Microsoft Fluent UI controls. I have not found a way to use it with the Fluent UI Link component though.
myermian
  • 31,823
  • 24
  • 123
  • 215
2
votes
0 answers

ReactJs : Nested routes inside component don't work properly after protecting the component in App.js with Private route

Originally this is how the route looks like in App.js: App.js /> DefaultLayout.js {routes.map((route, idx) => { return route.component ? ( …
2
votes
2 answers

React Router rendering only base path (/) and throwing error for other paths when requested directly in the browser

I am new to ReactJS and facing an issue with Routing. This is my App.js file where I have defined my React Router. import React from "react"; import { BrowserRouter as Router, Route, Link } from "react-router-dom"; import Home from…
2
votes
1 answer

React Router v4 - Dynamic Config with the changed default route

I'm working with the React router v4 now and I want to have a route-config in a separated object, so I followed for the documentation an I did something like this (see code below) I want to achieve this flow: When an user moves to a Customer module…
Velidan
  • 5,526
  • 10
  • 48
  • 86
2
votes
2 answers

React-router routes with multiple children

One of my routes needs two children to make what I want to do work. The main app page where I define all the routes would probably look something like this:
theJuls
  • 6,788
  • 14
  • 73
  • 160
2
votes
1 answer

How to update page with react-router-component

I'm using react-router-component (not react-router) to handle routing in my single page application. Refreshing the page or typing route manually in address bar results in page not found. How to handle the refresh and navigation by address in…
Tuomas Toivonen
  • 21,690
  • 47
  • 129
  • 225
2
votes
0 answers

react-router root onChange hook replace url cause infinite loop

It seems if I change path in root onEnter or onChange hook, the url will change infinite(?_k=u9huwr will always change). But if I change path in child routes, it will work. Actually I want to handle the authentication in one place, otherwise every…
jason
  • 1,621
  • 6
  • 21
  • 39
2
votes
1 answer

react-router root onChange to replace path infinite

It seems if I change path in root onEnter or onChange hook, the url will change infinite. But if I change path in child routes, it will work. Actually I want to handle the authentication in one place, otherwise every child route should handle the…
jason
  • 1,621
  • 6
  • 21
  • 39
2
votes
1 answer

How to use react-router 2 as server side routing with expressjs?

Server side rendering with react-router This documentation is not sufficient enough to understand how to use react-router 2 to render react components with different types of http request like get, post , put etc. on server side.
manas
  • 6,119
  • 10
  • 45
  • 56
1
vote
1 answer

How to use optional parameter path for routing

Using React Router Dom V6 Have MainView that has two optional parameter like, id, this time, "key" is not exist key, this time, "id" is not exists Both paths points to same view, just need key or id distinguish params Trying to achieve using below…
1
vote
1 answer

CartItems routing error using React-Router-Dom v6

I am trying to introduce 'cartItems' functionality to my react-redux app and store the added data in the browser's local storage. Indeed the problem raises when I try to show cart items by clicking on the cart link at the navbar section. The error…
1
vote
1 answer

How to redirect / path into /app in react router 6?

I have different routes for different pages. How to redirect / into /app in the new version of react router?
1
vote
1 answer

Call componentDidMount() manually even if component is already mounted

I have a class Dashboard component which fetch data from multiple API's in componentDidMount() with props received from route and renders a charts. componentDidMount() { this.urls = ChartProps[this.chart].api; this.title =…
Mahendra
  • 908
  • 1
  • 18
  • 38