-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
styled-components version 5+ causing invalid hooks call error with enzyme's .dive() and .shallow() #3037
Comments
@manveers96 Have you been able to go around this problem? Or do you still have it? |
me too |
@andreyluiz Was not able to0 find a solution for this problem. Tried the workaround suggested by Dan Abramov over here: facebook/react#15315 (comment) but this was not the case for my app as I had a single version of react being used according to the bundler. I checked this using If anyone has any fix for this, please suggest. |
I had the same problem, turns out I installed styled-components in the parent folder of the project and not in the create-react-app folder. Deleted styled-components, cd [react-app], npm install styled-components and the error is gone |
thanks a lot. i solved my problem refer to your comment! |
Environment
System:
Binaries:
Issue Description
I recently upgraded from
styled-components@4.3.2
tostyled-components@5.0.1
and am getting an invalid Hook call error at a place where I'm using.dive()
function ofenzyme
.I was not getting this error with the previous version of
styled-components@4.3.2
. Probably, the error has been introduced afterstyled-components
updated from4.4.1 to 5.0.0
in which I can see one of the PRs asReimplement StyledComponent using hooks
#2390. I'm using enzyme's.dive()
function in setting up the snapshots for my React components.Can we have a look at why we might be getting this issue?
PS: This issue occurs with
.shallow()
function also. I've also upgradedjest-styled-components
to7.0.0
The text was updated successfully, but these errors were encountered: