Questions tagged [react-router-component]
110 questions
1
vote
2 answers
React Router change the link but can't changed the body
React router Link tag wokred in the first page and page also changed but in the 2nd page have many link If i click on this link it can changed the link but not body how can i fix it...
Router code :

Fahad Ali
- 47
- 1
- 7
1
vote
1 answer
In React Router Dom, redirect not work if i don't press enter or refresh page
I have a strange problem with React Router Dom.
In my code I have:
if (this.state.area) {
return ( )
}
In the url it correctly writes "localhost: 3000 / list_services, but it seems not to load the page. If I…

Parma Libera
- 166
- 1
- 16
1
vote
2 answers
React array state is not updating
I want to populate both the array state but projectItems doesn't update in useState and when i put projectItems the component re-renders. so, i am using usecallback but when i put filteredItems and projectItems as dependency array in useCallback and…

devesh
- 111
- 2
- 11
1
vote
2 answers
How do you pass ":" in a URL without referring to a dynamic value in React?
The problem is that when you want to introduce a dynamic value to a url is that you have to use ":" to refer to it.
For example, let's say I have a list with a lot of users and I add a button to get more info about them, and I want the URL to have…

gxp2
- 149
- 2
- 11
1
vote
2 answers
React-router-dom: Clicking on Link adds the route to the Url Link indefinitely
After several attempts, I have managed to implement basic nested-routing with React-router-dom.
Here's the simple project structure:
Here are the relevant files:
App.js
import React from "react";
import logo from "./logo.svg";
import…

AG_HIHI
- 1,705
- 5
- 27
- 69
1
vote
1 answer
React-router-dom: Nested routes is not working but routes instead from within the root component App
I am following this tutorial to implement Nested routing.
Here's the relevant code:
App.js
…

AG_HIHI
- 1,705
- 5
- 27
- 69
1
vote
1 answer
ReactJS Route Components/Render
I created a simple booking app with 3 files, App.js, Booked.js (1st child) and Details.js (2nd child)
I'm trying to access App.js to delete a data using the 2nd child(Detail.js) but I can't proceed because it throws me an error of
"TypeError:…

Drew Cordano
- 962
- 9
- 16
1
vote
1 answer
How to display different navbar component for different reactjs pages
I am trying to display two different navbar component one as the main site navbar and one for the dashboard navbar.
I have tried creating two reusable components namely:
and
Here is their implementation:
const…

Lawrence Eagles
- 11
- 1
- 2
1
vote
0 answers
Replace and push still don't work on same pages
I have a simple inbox page that opens user messages. The trouble is that when a user clicks a message from the inbox from the inbox page...nothing happens.
I understand why this is the case for push but for replace it seems like a bug.
Attempting as…

notElonMusk
- 314
- 1
- 4
- 21
1
vote
2 answers
Understanding React Code
I am learning React.js. I am familiar with below code
class Login extends Component {
state = { email: '',};
render = () => {
return (//some JSX code);
}
}
But I got below code as solution of an issue.
const PrivateRoute = ({…

abu abu
- 6,599
- 19
- 74
- 131
1
vote
0 answers
react router not rendering the view but url is changing
I have two tabs: Profile and Friends and the navlink are as follows
{tab.name}
where tab = [{
"name": "Profile",
"url": 'timeline'
},
{
…

Saurav Dutta
- 83
- 2
- 10
1
vote
1 answer
react-router v4.2.2 Switch isn't working; always showing the main component
I'm using react-router to direct a set of cards on the main page, to other individual pages. However, when I click on a card, the new page renders underneath the set of cards, when what I want is to render ONLY the new page. I think the problem may…

user74843
- 701
- 2
- 10
- 28
1
vote
1 answer
go back button doesn't navigate back
My code for App.js from where all the routing is done
import React from 'react';
import ReactDOM from 'react-dom';
import $ from 'jquery';
import {FirstPage} from './FirstPage.js';
import {Panorama} from './Panorama.js';
import…

Aayushi
- 1,736
- 1
- 26
- 48
1
vote
2 answers
Can a React component be used in the unmounted state?
I have a React component that creates an event listener, and displays a list of links. Once the user clicks on a link the componentWillUnmount method is called and a new page displayed. My component continues to function and handle events after it…

Ted1391
- 139
- 3
- 12
1
vote
1 answer
You are manually calling a React.PropTypes validation function for the `path` prop on `Route`
Getting this warning when i use router in reactjs.
Warning: You are manually calling a React.PropTypes validation function for the path prop on Route. This is deprecated and will not work in production with the next major version.
ReactDOM.render(
…

Krishna Babu
- 55
- 7