mariusandra / pigeon-maps

ReactJS Maps without external dependencies
https://pigeon-maps.js.org/
MIT License
3.44k stars 142 forks source link

Invalid hook call. Hooks can only be called inside of the body of a function component. #122

Closed goscha01 closed 3 years ago

goscha01 commented 3 years ago

If I use my app works well and a map is rendered. However, if I try to use I get the errors: react.development.js:1476 Uncaught 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 breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem. at resolveDispatcher (react.development.js:1476) at useState (react.development.js:1507) at Marker (index.esm.js:1476) ...

index.js:1 The above error occurred in the component:

at Marker (http://localhost:3000/static/js/0.chunk.js:1597:28)
mariusandra commented 3 years ago

I'm not sure this is connected to pigeon-maps (please correct me). The Marker component does use one useState hook, but that normally doesn't trigger such an error. You could inadvertently have more than one copy of React in your app, causing this issue.

If you can provide any more details or a reproducible test case, please reopen the issue.