react-router-dom Questions
3
Solved
I have the below component as the main layout. When I click on the menu item, I want them to navigate to the home, holiday calendar, and event pages. What can I do with this horizontal menu? The be...
Munoz asked 6/11, 2022 at 18:34
5
Solved
I am trying to add tailwind-css to Navlink(react-router-dom). I want to add active style. To add active styles I can use
<NavLink to="/faq" activeStyle={{fontWeight: "bold",c...
Quicksand asked 25/3, 2021 at 9:18
5
When I add routing with React Router to my React app, it throws error and shows warning:
Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could ...
Overwrite asked 15/7, 2022 at 14:11
4
Solved
On my website, I have a few routes that are made using React-Router, that point to a few different pages on the website itself. It all works fine in Development mode, but the build version is where...
Plumlee asked 7/2, 2023 at 15:45
4
I'm working on the NetNinja react-router in-depth #6 tutorial, but I'm trying to do it with typescript. I am fetching data from a JSON object, and I'm using the useLoaderData() hook and trying to m...
Kristenkristi asked 15/3, 2023 at 3:20
3
Solved
This is my primary react file:
// App.tsx
const App: FC = () => {
const isLoggedIn: boolean = localStorage.getItem('logged_user') !== null;
return (
<BrowserRouter>
<Routes>
&...
Doctor asked 13/12, 2021 at 22:52
4
I'm using react-router-dom v6.
When using useNavigate like this:
let navigate = useNavigate();
navigate("/", {state: state});
I can access it by useLocation().location.state
My question ...
Kidding asked 5/5, 2022 at 2:21
10
I am facing a problem. I am trying to use React Router but it keeps showing me a blank page.
Here is my code:
App.js:
import React from "react";
import { BrowserRouter as Router, Routes, ...
Helli asked 5/2, 2022 at 13:7
4
Solved
I'm trying to create web app in codepen. I'm using React, ReactDOM. All was fine. But when I added react-router-dom to my project, I got an error:
react-router-dom.min.js:1 Uncaught Error: Cannot ...
Dumyat asked 11/4, 2017 at 22:53
7
Solved
In React Router v6, how can I go back to the previous page using <Link> instead of useNavigate().
// Instead of this...
<button onClick={() => navigate(-1)}>
// ...it needs to be th...
Caritacaritas asked 19/6, 2022 at 10:17
5
Solved
I would like to redirect my url for e.g to '/questions/1' when I only write /questions
Grati asked 21/1, 2022 at 17:12
6
Solved
I am trying to organize the routes in `react-router-dom v6. And here is my flow:
root AppComponent
function AppComponent() {
return <AppRoute />;
}
AppRoute.js (base routes)
const AppRoute ...
Again asked 9/11, 2021 at 15:15
7
Solved
I'm using react-router v6. I want to navigate to a URL that has searchParams, but I'm not seeing a way to do this out of the box. useNavigate allows me to navigate to a URL by passing in a string. ...
Wabash asked 19/1, 2021 at 22:48
5
Solved
In one component, there is a <Link> (from react-router-dom) passing an object in the state property.
Another component called ReceiverComponent is receiving that object correctly. However, t...
Galata asked 8/3, 2020 at 10:46
3
Solved
With this bucket policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::...
Graphitize asked 28/5, 2019 at 15:35
6
Solved
I suddenly get this error and not sure why.I did not change the "react-router-dom": "^6.0.0-beta.4" version. But the "react-dom": "^16.8.4"" had changed...
Iiette asked 23/9, 2021 at 11:59
6
Solved
I have the following Router definition:
<Router>
<Route exact path='/' component={Home}/>
<Route path='/about' component={About}/>
<Route path='/code' component={Code}/>...
Grew asked 20/6, 2019 at 11:19
2
Solved
I'm using React Router v6 and following are my routes:
const router = createBrowserRouter([
{
path: '/',
element: <App />,
errorElement: <ErrorPage />,
children: [
{
index: true,...
Bedpan asked 1/6, 2023 at 19:13
6
Solved
I'm new to React and trying to make a loading/greeting page that navigates on to the next after a few seconds of being shown. In React Router v6, we have the useNavigate() hook to allow you to cont...
Glyptics asked 14/9, 2022 at 17:32
5
I have a react app created with create-react-app and am using react-router-dom for routing.
The general layout is:
App.js
<BrowserRouter>
<BodyContent />
</BrowserRouter>
Bo...
Bimetallism asked 10/10, 2018 at 22:50
7
Solved
I am basically trying to intercept route changes. Maybe something equivalent of vue's beforeEach in React Router v6 could be useful as React Router v.6 does not include usePrompt.
BEFORE each route...
Kierkegaardian asked 22/3, 2022 at 13:13
3
Solved
As https://github.com/remix-run/react-router/issues/8139 is finished and we got useBlocker in v6, did anyone got it to work?
This is what I got so far and pretty much I'm stuck with error I quite d...
Misjudge asked 16/1, 2023 at 13:50
6
Solved
I am making a single scroller page using React and want to navigate to a specific section of the page. In HTML we use an href and anchor tag to achieve this interaction.
I found a React library cal...
Primate asked 15/2, 2019 at 18:52
4
Solved
I migrated from React Router v5 to v6 following this tutorial. I want to test it with react-testing-library, but my old unit tests (using the pattern in this doc) stopped working.
My app with React...
Selective asked 11/11, 2022 at 7:53
2
Solved
I have a component that I am using in React Router v6 for managing private routes, that does some checks on an auth token, and will either render the Outlet component or will redirect to a login pa...
Foy asked 10/1, 2022 at 15:30
1 Next >
© 2022 - 2024 — McMap. All rights reserved.