Questions tagged [react-router-component]
90 questions
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
- 89
- 1
- 8
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…
Guillermo
- 69
- 6
1
vote
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
- 29,999
- 21
- 111
- 199
1
vote
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 ? (
…
AG_HIHI
- 903
- 2
- 11
- 30
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
- 377
- 2
- 11
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
- 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…
itshinkswhenitscold
- 153
- 1
- 10
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
- 4,662
- 6
- 48
- 93
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
- 611
- 1
- 8
- 24
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,431
- 16
- 35
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…
Ted N
- 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
- 6
1
vote
1 answer
How to access value of a routing parameter in react?
I want to have a 'dynamic route' for a section of my app, which was done like this:
So far this works, but in Component I would like to access the value of id because it changes a bunch of things…
theJuls
- 4,644
- 5
- 41
- 90
1
vote
2 answers
react separate routes for logged in and guest user
React-router-component's official github page mentions as follows:
For example you can return a different set of allowed locations for anonymous and signed-in users.
That's exactly what I want to achieve, but I can't actually find the tutorial…
Tuomas Toivonen
- 15,414
- 22
- 98
- 170
1
vote
0 answers
Converting String into ReactComponent
I know its weird use case but already im in the middle of PoC and stucked with below problem.
I have X jsx files in autoGenerated directory (which are transpiled from HTML using react-magic library). Now I need to dynamically load them into my react…
MariuszJasinski
- 504
- 3
- 8