Internal React warning when using recoil in stable react releases and not experimental
See original GitHub issueI bootstraped a react app using create-react-app
, then added recoil
and just pasted the code from the website demo.
When the app renders for the first time, an internal react warning in console is shown:
Warning: Cannot update a component (`he`) while rendering a different component (`CharacterCount`). To locate the bad setState() call inside `CharacterCount`, follow the stack trace as described in https://fb.me/setstate-in-render
in CharacterCount (at App.js:31)
in div (at App.js:29)
in CharacterCounter (at App.js:7)
in RecoilRoot (at App.js:6)
in App (at src/index.js:7)
in StrictMode (at src/index.js:6)
Updating react
dependencies to the experimental ones solved the warning.
PS: the issue doesn’t occur with react^16.12
but only with ^16.13.1
Here is a codesandbox demo
So, should we use recoil only with the experimental react release ?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Blog | Recoil
Sync with React Hooks or Props - This library enables syncing atoms with React hooks or props that are not accessible from atom...
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 >Introducing Concurrent Mode (Experimental) - React
Concurrent Mode is a set of new features that help React apps stay responsive and gracefully adjust to the user's device capabilities and...
Read more >Versioning Policy - React
If a release includes non-essential changes — such as internal refactors, changes to implementation details, performance improvements, or minor bugfixes — we ...
Read more >Invalid Hook Call Warning - React
You might be using a version of react-dom (< 16.8.0) or react-native (< 0.59) that doesn't yet support Hooks. You can run npm...
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 FreeTop 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
Top GitHub Comments
Thanks for reporting, I’m currently looking into this.
Duplicate of #12