ReactRouterRoute breaks with React Router v6
See original GitHub issueThis library no longer works with React Router v6 (currently in alpha).
Warning: Failed prop type: Invalid prop `children` supplied to `Route`, expected a ReactNode.
in Route (created by QueryParamProvider)
React Router v6 no longer allows for functions as child components. The following code from this library breaks:
The new signature of Route in React Router v6 is:
export interface RouteProps {
caseSensitive?: boolean;
children?: React.ReactNode;
element?: React.ReactElement | null;
path?: string;
}
https://github.com/ReactTraining/react-router/blob/dev/packages/react-router/index.tsx#L235-L240
Issue Analytics
- State:
- Created 3 years ago
- Reactions:16
- Comments:21 (4 by maintainers)
Top Results From Across the Web
Migrating to React Router v6: A complete guide
Migrate your React Router applications from v5 to v6 with this in-depth guide, including a review of additions and improvements from v5.
Read more >Upgrading from v5 v6.6.1 - React Router
It also introduces a few breaking changes from version 5. ... This is a React Router v6 app import { BrowserRouter, Routes, Route,...
Read more >Ultimate React Router v6 Guide
This article will be broken down into 4 sections. React Router Basics; Advanced Route Definitions; Handling Navigation; Routers In Depth ...
Read more >Routing is not working using react-router-dom-v6.4.2 [duplicate]
I had created a 3 components in /src/pages named AddCoupon , Addvertical , Addmetadata . Now then I created a file Routes.js in...
Read more >Introduction to react-router-dom: setting up your first routes
React JS as a Single Page App library doesn't include built-in routing capabilities as Angular does; it needs a library called ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi all, finally took some time to see what was needed to get this working. @noah-potter’s suggestion might work too, I didn’t investigate, but an alternative style is available in the examples directory.
https://github.com/pbeshai/use-query-params/tree/master/examples/react-router-6
Update See a TypeScript version here
Perhaps after release I’ll look towards building it into the library, but for now it should give you an idea. The basics repeated here:
v6 has been released now, any chance of integrating the above into the this library?