Category "react-router"

React Router v4 routes not working

I am relatively new to reacts and I'm trying to figure out how to get React router to work. I've got a super simple test app that looks like this: import React

React.createElement: type is invalid -- expected a string

Trying to get react-router (v4.0.0) and react-hot-loader (3.0.0-beta.6) to play nicely, but getting the following error in the browser console: Warning: React.c

How to do nested conditional rendering in React?

A situation I have not ran into before due to way roles/authentication work in a project I am working on. On login, the code returns whether the user is just a

Target Active Link when the route is active in Next.js

How to target the active Link in Next.js like they way we do it in React-Router-4? Meaning, give the active link a class when its route is active?

How to use React Router with Laravel?

I needing use React Router with a Laravel project. But when I create router on the React Router and try access, Laravel accuse Route not exist error. How to c

React Router: How to stop redirecting until API returns a response?

I have a login page but that authenticates the login on router with a call to the backend. The backend returns a response 200 if the user is authenticated, and

How do you programmatically update query params in react-router?

I can't seem to find how to update query params with react-router without using <Link/>. hashHistory.push(url) doesn't seem to register query params, and

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-