React 18 strict mode breaks URL query params
See original GitHub issueWhat you were expecting:
That react admin works normally with React 18 strict mode
What happened instead:
When I click on a column header to sort the url doesn’t update with query params, so nothing happens.
Steps to reproduce:
In the code sandbox try to sort a column, see it doesn’t work. In index.js, comment out the React 18 section and uncomment the React 17 mode section, sorting should work now.
Related code:
https://codesandbox.io/s/sweet-fast-1pkgk5?file=/src/index.js
React 18 mode (broken):
import App from "./App";
import * as React from "react";
import { StrictMode } from "react";
import * as ReactDOMClient from "react-dom/client";
const rootElement = document.getElementById("root");
const root = ReactDOMClient.createRoot(rootElement);
root.render(
<StrictMode>
<App />
</StrictMode>
);
React 17 mode (working):
import App from "./App";
import * as React from "react";
import { render } from "react-dom";
const container = document.getElementById("root");
render(
<React.StrictMode>
<App />
</React.StrictMode>,
container
);
Environment
- React-admin version: 4
- React version: 18
- Browser: Latest Chrome and Safari
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
How to Update Query Params in React - MakeUseOf
Using React Router to Update Query Parameters ... enters a query into a search bar, you should store that query in the URL....
Read more >Concurrent UI Patterns (Experimental) - React
React 18 was released with support for concurrency. However, there is no “mode” anymore, and the new behavior is fully opt-in and only...
Read more >How to get parameter value from query string? - Stack Overflow
React Router v4 · 1.use regular expression to get query string. · 2.you can use the browser api. image the current url is...
Read more >Using strict mode in React 18: A guide to its new behaviors
Introduction to React's strict mode; Warnings on the use of unsafe lifecycle methods; Recommending the createRef API over the legacy string ...
Read more >decodeURIComponent() - JavaScript - MDN Web Docs - Mozilla
A new string representing the decoded version of the given encoded Uniform ... Decoding query parameters from a URL ... Chrome Android18.
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
Yes, closing.
Can this one be closed?