Category "react-router"

How to hydrate server-side parameters with React + Redux

I have a universal React app that is using Redux and React Router. Some of my routes include parameters that, on the client, will trigger an AJAX request to hyd

react route component is not rendering anything

I created my app with create-react-app and tried to use react-router on it. but it's not working at all. I am using react-router-dom 5.3.0 version. But if I typ

Programmatically navigate using React router

With react-router I can use the Link element to create links which are natively handled by react router. I see internally it calls this.context.transitionTo(.

Simplest test for react-router's Link with @testing-library/react

I'm trying to understand how to best test that react-router behaves as expected with @testing-library/react. The simplest test I can think of, is to verify tha

React Native InitialRouteName

I'm using React Native v5.0 and trying to set a nested navigation for my app, however, the prop "initialRouteName" don't seem to work, even if i set it alone wi

React Admin: I'd like to route to <Show> view from a list

I'm currently using react admin.I would like to route to my ActivityShow component when I click a row in the Resource list. When I click the row, the app route

Animating route transitions with CSSTransitionGroup and React-Router v6

I'm starting to use React-Router v6, and running into issues animating route transitions. Both the react-router docs and the react-transition-group docs speci

React-Router External link

Since I'm using react-router to handle my routes in a react app, I'm curious if there is a way to redirect to an external resource. Say someone hits: example.

useLocation: Hooks can only be called inside of the body of a function component

I'm trying to use the useLocation hook in my function component but I'm getting Error: Invalid hook call. Hooks can only be called inside of the body of a funct

React-router : How to trigger $(document).ready()?

In my current React + React-router setup my component imports some jQuery things (owl.carousel and magnific popup) I want to keep the code clean, so the extern

react-router-bootstrap linkcontainer

How do I use react-router-bootstrap to link to another react component? Do I need to set up my routes with react-router first? I don't know how to use react-rou

Multiple path names for a same component in React Router

I am using the same component for three different routes: <Router> <Route path="/home" component={Home} /> <Route path="/users" componen

react-router-dom <Routes> and <BrowserRouter> errors

I am using react-router-dom and am facing an issue with using <Routes>: Here is my index.tsx file: import React from 'react'; import ReactDOM from 'react-

Detect previous path in react router?

I am using react router. I want to detect the previous page (within the same app) from where I am coming from. I have the router in my context. But, I don't see

Netlify renders 404 on page refresh (using React and react-router)

I have deployed my site with Netlify, and I’m having trouble with the routing. Here is my website: https://redux-co.netlify.com/ And my GitHub repo: ht

Using react-router to switch between pages but my props aren't displaying, is this a router version issue?

I'm trying to render props with the code I have written however, only my header shows. My "about" page also displays properly. This is the warning message that

React-router did not work on production

there, I am using react-router for this app. It works fine on my local server. Here is the code: var routes = ( <Router history={browserHistory}> <

react router v6 navigate outside of components

In react-router v5 i created history object like this: import { createBrowserHistory } from "history"; export const history = createBrowserHistory(); And then

react router's location state becomes undefined on change of route

I want to store url query as a state on location. ~ history.push({ + ...history.location, + search: query.toString(), + state: { + myState

React Router with optional path parameter

I want to declare a path with an optional path parameter, hence when I add it the page to do something extra (e.g. fill some data): http://localhost/app/pat