-
Notifications
You must be signed in to change notification settings - Fork 331
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
Invalid hook call when using yarn link #548
Comments
I've discovered that this issue disappears if I |
Specifically, the problem is that my library includes a copy of |
@tlindsay The solution to solve this "linking" issue, is to add this into your main projects NWB config.
This issue solves the "Invalid Hook Call" problem that occurs when you Npm Link a library that uses hooks into your project. |
This issue is a: Bug report
I'm developing a library which uses
useState
anduseEffect
hooks using thereact-component
nwb template. It works great in thedemo/
app.I tried using
$ yarn link
to test my library in an app, and I getInvalid hook call. Hooks can only be called inside of the body of a function component.
I'm new to React, so I assumed I must be doing something wrong with my build, so I started looking around for examples. I found react-hooks-toolbox and decided to see how that's configured. I added it as a dependency to my project, and confirmed that I could import the simplest hook defined in that project (
useDebounce
). That worked perfectly.After that, I cloned the repo, installed deps, ran
$ yarn build
and linked it up. At that point, my app started throwing the sameInvalid hook call
on theuseDebounce
hook.I'm using
nwb@0.24.5
for my lib, andreact-hooks-toolbox
is usingnwb@0.23.0
.The text was updated successfully, but these errors were encountered: