react-live icon indicating copy to clipboard operation
react-live copied to clipboard

React issue in 2.2.3 -> 2.4.0 update

Open frattaro opened this issue 3 years ago • 5 comments

Getting this classic gem w/next.js:

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://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.

Related to (?) #278

I tried setting config.resolve.alias.react/-dom but it doesn't seem to have any affect.

frattaro avatar Jan 19 '22 15:01 frattaro

I know what the problem is, it's because this library uses React 16.8.0, and the project uses React 17.0.2, if you install React 16.8.0 everything will work fine, but I would like to use the library with React 17.0.2, so far I haven't found a solution to this problem

IlayMorozoff avatar Jan 20 '22 13:01 IlayMorozoff

Yeah seems this is the fix, so I subscribed to it: https://github.com/satya164/react-simple-code-editor/pull/84

frattaro avatar Jan 20 '22 14:01 frattaro

@frattaro can i ask you to try v3.0.0-rc1? This new major uses both React 17 and a replacement for react-simple-code-editor under the hood.

you can install using

yarn add react-live@next

i'd be really grateful for any feedback. thank you! 🙇🏻‍♂️

jpdriver avatar Jan 26 '22 16:01 jpdriver

Works great -- if you want to try it out, it's right here: https://atomic-react-2hffinuzp-securex.vercel.app/components/accordion

frattaro avatar Jan 26 '22 17:01 frattaro

great! thank you so much for reporting back 😄

i'd like to wait a little longer for any other feedback before marking that RC as the latest stable version, but please feel free to keep using it and testing it in the meantime.

it's probably unlikely to change between now and the official release

jpdriver avatar Jan 26 '22 17:01 jpdriver