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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
incepter opened this issue May 15, 2020 · 8 comments

Comments

@incepter
Copy link

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 ?

@incepter
Copy link
Author

Here is the full stack trace.
image

I will continue through the tutorial to know the basics and advanced stuff of recoil, if this is not solved I wish I work on it.

@incepter
Copy link
Author

I figure out that this warning was added after the experimental and 16.12 releases.

@davidmccabe
Copy link
Contributor

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

@Xiphe
Copy link

Xiphe commented May 16, 2020

facing similar issues on

"react": "0.0.0-experimental-33c3af284",
"react-dom": "0.0.0-experimental-33c3af284",
"recoil": "0.0.7"

@kalysr
Copy link

kalysr commented May 16, 2020

facing similar issues on

    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-scripts": "3.4.1",
    "recoil": "^0.0.7"

@acutmore
Copy link

Possible duplication of #12

@incepter
Copy link
Author

incepter commented May 17, 2020

Possible duplication of #12

Yes absolutely a duplicate, didn't notice it.

I do not know how to flag this issue as a duplicate.

@drarmstr
Copy link
Contributor

Duplicate of #12

@drarmstr drarmstr marked this as a duplicate of #12 May 18, 2020
This issue was closed.
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

6 participants