React experimental concurrent issue
See original GitHub issuehttps://github.com/facebook/react/pull/18838
I tried swr
with suspense mode, with a recent 0.0.0-experimental-7f28234f8
react build, and I get errors Can't perform a React state update on a component that hasn't mounted yet
for each useSWR
call.
This indicates that there’s a side-effect spawned during render, that then asynchronously tries to set state when the response comes back. E.g. kick off a request and then setState with the result. It’s a common mistake when implementing Suspense.
This should be done in useEffect.
Does this make sense to you?
Unfortunately I can’t help you a lot more than that, it doesn’t help to where the error comes exactly.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Introducing Concurrent Mode (Experimental) - React
In Concurrent Mode, rendering is not blocking. It is interruptible. This improves the user experience. It also unlocks new features that weren't possible...
Read more >What happened to concurrent "mode"? #64 - reactwg/react-18
In the Plan for React 18, we shared that the new strategy is to allow users to upgrade React 18 with no changes...
Read more >Experimental React - Concurrent Mode is Coming - GrapeCity
In Concurrent Mode, React can pause expensive, non-urgent components from rendering and focus on more immediate or urgent behaviors like UI ...
Read more >Concurrent Rendering in React 18 - Telerik
Concurrent Mode was introduced as an experimental feature. In favor of a more gradual adoption plan that allows you to opt in to...
Read more >React: Rendering using Concurrent Mode and Suspense
Understanding React's experimental Concurrent and Suspense. ... Concurrent rendering solves many common page load issues like block ...
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
@huw @Jakst 0.3.9 should fix this issue. could you bump version to try again? thanks!
Here’s a codesandbox link: https://codesandbox.io/s/quirky-burnell-cn51p?file=/src/App.tsx. The problem only appears when there are multiple
useSWR
hooks used. Also, the warning doesn’t appear on the initial load of the page. You have to refresh the codesandbox preview specifically for some reason (I’m guessing that’s a codesandbox specific issue though since locally I see the warning on the initial load).