preactjs / signals

Manage state with style in every framework
https://preactjs.com/blog/introducing-signals/
MIT License
3.64k stars 89 forks source link

React has detected a change in the order of hooks #452

Closed sahajjain1 closed 6 months ago

sahajjain1 commented 7 months ago

getting error : React has detected a change in the order of hooks... while using @preact/signals-react@1.1.1 and cant update the signal version above 1.1.1 as it will not work with my React version 17.0.2 any suggestions?

image

similar to https://github.com/preactjs/signals/issues/414

XantreDev commented 7 months ago

Do you using signals with Vite? Webpack? Which version of @preact/signals-react is not working with 17.0.2? I know that 1.2.1 should work with this react version

sahajjain1 commented 7 months ago

Using Webpack i tired with 1.2.1 and 1.1.1 getting the same above issue React has detected a change in the order of hooks. but when i tried your (https://github.com/XantreGodlike/preact-signals/tree/main/packages/react) it was working perfectly. we have decided to upgrade the react to latest versrion and now we can use the latest version of @preact/signals-react hopefully the issue wont show up again

edgars-sirokovs commented 7 months ago

I encountered this warning with Remix (v2.3.1) + Vite (v5.0.4), @preact/signals-react v1.3.7

Warning: React has detected a change in the order of Hooks called by RemixBrowser.

XantreDev commented 7 months ago

I encountered this warning with Remix (v2.3.1) + Vite (v5.0.4), @preact/signals-react v1.3.7

Warning: React has detected a change in the order of Hooks called by RemixBrowser.

I'm not sure that for now there is a bullet proof way to use automatic deps tracking in remix. I will release the manual method of integration with HOCs - it will be bullet proof and work in all envitements

XantreDev commented 7 months ago

I've done it. Check it out