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

New Warning: Invalid hook call in development with latest react experimental #3409

Closed
bbenezech opened this issue Feb 18, 2021 · 5 comments · Fixed by #3521
Closed

New Warning: Invalid hook call in development with latest react experimental #3409

bbenezech opened this issue Feb 18, 2021 · 5 comments · Fixed by #3521

Comments

@bbenezech
Copy link

In development, react@experimental triggers a react warning.

Environment

react-dom since 0.0.0-experimental-dc27b5aaa (2 weeks ago)
all versions of styled-components affected

Reproduction

https://codesandbox.io/s/styled-components-base-forked-yzpjn?file=/package.json

Steps to reproduce

Open the sandbox => console

Expected Behavior

No console.error in dev

Actual Behavior

console.error Warning: Invalid hook call. Hooks can only be called inside of the body of a function component.

@haneenmahd
Copy link

Yes, I do have the same problem. when using the styled component element inside a React.Component class.

@haneenmahd
Copy link

Now it also affects the function components too

@DannyvanderJagt
Copy link

Any updates on this?

@DannyvanderJagt
Copy link

Update: I switch to emotion for now, they work out of the box. Going to monitor this thread and switch back when it works in styled-components again.

@eps1lon
Copy link
Contributor

eps1lon commented Jun 26, 2021

Duplicate of #3394

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

Successfully merging a pull request may close this issue.

4 participants