deVSner

Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:1. You might have mismatching versions of React and the renderer (such as React DOM)2. You might be breakin.. 본문

Error collection/react (redux, saga) 에러

Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:1. You might have mismatching versions of React and the renderer (such as React DOM)2. You might be breakin..

RudeofSun 2020. 7. 6. 23:12

 

겁나 럭셔리해 보이는 에렄ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ

 

 

스타일드컴포넌트를 주석처리 했다

 

근데 왜 스타일드 컴포넌트 훅과 관련된 거지???

 

추가 ============================  

 

에러랑 스타일드 컴포넌트가 대체 무슨 상관인 건지 너무 궁금했다.

그래서 찾아봤다.

 

결론부터 말하자면, 스타일드 컴포넌트의 버전이 5 버전대 이상이면 저런 에러가 나는 거 같았다.

대개는 4버전대로 낮추면 해결이 됐다는 자료가 많았다.

 

내 레포를 보니까 5.1.1 버전이었는데, 다운그레이드하니까 리얼 해결이 됐다...

므야...

 

아래는 관련 자료

https://github.com/styled-components/styled-components/issues/3045

 

Styled-components version 5+ causes invalid hook call errors when trying to import styled-components based package · Issue #304

Environment System: OS: macOS 10.15.2 CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz Memory: 231.07 MB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 10.15.3 - /usr/local/bin/node Yarn:...

github.com