question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Internal React warning when using recoil in stable react releases and not experimental

See original GitHub issue

I 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)

image

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:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
davidmccabecommented, May 15, 2020

Thanks for reporting, I’m currently looking into this.

0reactions
drarmstrcommented, May 18, 2020

Duplicate of #12

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found