psb / astro-reason

7 stars 1 forks source link

React hooks warning #2

Open psb opened 1 year ago

psb commented 1 year ago
Warning: 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.

For some reason Astro installs two copies of React:

£ npm ls react
astro-reason@0.0.1 /Users/paulbacchus/Work/astro-reason
└─┬ @astrojs/react@2.2.1
  ├─┬ react-dom@18.2.0
  │ └── react@18.2.0 deduped
  └── react@18.2.0
psb commented 1 year ago

However, this is only a warning during dev and React still works during dev. The app also works after bundling and previewing the app.