Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"TypeError: Object(...) is not a function" error when trying to use react hooks (alpha) [duplicate]

When I try to use the new React hooks feature I run into this annoying error message for some reason.

I followed the instructions on the documentation and upgraded react to the latest alpha version with yarn add react@next.

like image 706
dj nag Avatar asked Oct 29 '18 02:10

dj nag


1 Answers

I actually solved this issue! Most likely what you did to start using hooks was just updated react using yarn add react@next or something similar, but you probably didn't upgrade react-dom which is why you're getting this error.

TLDR; Upgrade react-dom!!

like image 192
dj nag Avatar answered Nov 06 '22 09:11

dj nag