Skip to content

Getting "Warning: Invalid hook call." when using locally in App due to double React #302

Open
@jnachtigall

Description

@jnachtigall

Describe the bug
I use the library locally so I can make a few changes. This way I hit this error: https://stackoverflow.com/questions/56021112/react-hooks-in-react-library-giving-invalid-hook-call-error/57422196

The package.json has

"peerDependencies": {
"react": "^18.1.0",
"react-dom": "^18.1.0"

and the rollup config has
PeerDepsExternalPlugin(),

The problem is that the package.json also has these dependencies too:

"react": "^18.2.0",
"react-dom": "^18.2.0",

These last lines should be deleted and only peerDependencies used.

BTW:
There is also

"react-is": "^18.2.0",

But react-is does not seem to be used anywhere.

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions