preactjs / signals

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

Bug: Rendered more hooks than during the previous render. #370

Open betula opened 1 year ago

betula commented 1 year ago

I attached archive with small project on Vite that reproduced error:

react-rendered-more-hooks.zip

https://github.com/preactjs/signals/assets/421161/a0e472d7-2311-46dc-9bd7-bc56a24ee184

LaiArturs commented 8 months ago

I am not sure if it is related but might help someone looking for a solution to a similar problem.

I also had a "Rendered more hooks than during the previous render" error. This error showed in Chrome but not in Firefox. Running code in Firefox turend out I had another valid issue with my code: "Each child in a list should have a unique "key" prop".

As soon as I solved this error, "Rendered more hooks than during the previous render" error was also solved.