Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when upgrading react-router-dom to version 6: "A <Route> is only ever to be used as the child of <Routes>" #195

Closed
Avivhdr opened this issue Nov 13, 2021 · 2 comments

Comments

@Avivhdr
Copy link

Avivhdr commented Nov 13, 2021

Hi 馃憢馃徏

https://codesandbox.io/s/react-router-basic-forked-m6w00?file=/example.js

In the above Codesandbox, there is a simple react-router (v6) example wrapped with <QueryParamProvider />.
Code:

<QueryParamProvider ReactRouterRoute={Route}>
  <Routes>
    <Route exact path="/" element={<Home />} />
    <Route path="/about" element={<About />} />
    <Route path="/dashboard" element={<Dashboard />} />
  </Routes>
</QueryParamProvider>

The code results in the following Error:

Error
A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. 
Please wrap your <Route> in a <Routes>.

When commenting out the QueryParamProvider wrapper, the app renders.

use-query-params - v1.2.3
react-router-dom - v6.0.2

@pbeshai
Copy link
Owner

pbeshai commented Nov 15, 2021

Please follow these instructions for now #108 (comment)

@Avivhdr
Copy link
Author

Avivhdr commented Nov 15, 2021

Thank you!
I close this ticket.

@Avivhdr Avivhdr closed this as completed Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants