Questions tagged [react-routing]
70 questions
14
votes
4 answers
Conditionally set active class on menu using react router current route
I am using react router 1.0.2 and my routes look like this:
ReactDOM.render(

dagda1
- 26,856
- 59
- 237
- 450
13
votes
6 answers
How to use react router (createBrowserHistory) on Microsoft IIS to make routing working?
I am using react-router (createBrowserHistory) for my react app.
Below is my code of
var ReactDOM = require('react-dom') ;
var ReactRouter = require('react-router');
var Router = ReactRouter.Router;
var Route = ReactRouter.Route;
var Link =…

Dreams
- 8,288
- 10
- 45
- 71
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
3 answers
react-native-router-flux, how to get current scene key
Hey I'm trying to get current scene key while using react-native-router-flux.
my route file:
const AppRouter = connect()(Router)
class Routes extends Component {
render() {
function selector(props) {
console.log(props)
//…

Oscar Franco
- 5,691
- 5
- 34
- 56
5
votes
2 answers
How to Return a Page by ID with react-routing?
I'm just new to React and I'm having a hard time figuring out how to return a new page (a component) as I clicked the View button. I have a user table and per row has a View button. I can only retrieve the data in exactly the same page but I would…

Xev
- 109
- 1
- 1
- 12
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
5
votes
5 answers
React Router with React v0.14.3
I am creating an app using React and Material-UI, i have included the React-router as well. But i get the below error (Uncaught TypeError: (0 , _reactDom.ReactDOM) is not a function) when i run my App.
I am using React v0.14.3 and React-Router…

Sharath Bangera
- 139
- 1
- 8
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
3
votes
2 answers
Is there any way to hide the params from the query string in react routing?
Is there any way to remove the query string from the url in react application?
this.history.push('component/:id')
I want id to be removed from the browser url while navigation.

Vikas Kumar
- 43
- 1
- 1
- 6
3
votes
0 answers
Inspect history in react-router-dom with HashRouter
As described in the title, I'm using react-router-dom and HashRouter to serve a client side app in a portion of my site.
What I'm trying to achieve is something like a back button to pop through the history. This is fine in normal situations, but…

Matt Whetton
- 6,616
- 5
- 36
- 57
3
votes
3 answers
React router. Cannot GET when refreshing a page or write url manually
I am trying to build a SPA with react router. When I am navigating with link it works perfect, but with refreshing or writting url it gives me cannot GET /(any route except main). I was trying to add historyApiFallback : true option to my webpack…

Deni Chan
- 75
- 1
- 8
3
votes
2 answers
Minimum nodejs server setup needed for React using react-router and browserHistory
My current server.js:
let express = require('express');
let harp = require('harp');
let path = require('path');
let app = express();
app.use(express.static(__dirname + "/dist"));
app.use(harp.mount(__dirname + "/dist"));
let port =…

Matthew Herbst
- 29,477
- 23
- 85
- 128
3
votes
1 answer
3
votes
2 answers
Routing is not work with react-router-redux actions
When use the Link, router works as expected, though i get a warning [history] pushState is deprecated; use push instead.
Using routeActions from react-router-redux does't work, url was change (http://localhost:3002/addCity), but view still the same…

kirsanv43
- 358
- 2
- 13
2
votes
1 answer
Can we nest a component containing routes inside Routes component from react-router?
I am trying to upgrade react router package from version 5 to 6. I have replaced Switch to Routes as below:
// takes to the editor route
{Some component}
This…

Deepak Negi
- 214
- 4
- 11