Hacker News new | ask | show | jobs
by aeroaero 1185 days ago
This page should be mandatory reading for any dev working in react. The biggest mistake I see with devs of all levels is over use of effects.

This seems to be especially bad for anyone who originally worked with class components. The mental modal shift was large and people tried to fit their understanding of lifecycle methods into hooks, attempting to replicate similar behaviour. The docs at the time did a poor job of explaining why this was a bad idea.

2 comments

100%. Effects are an escape-hatch, and it's really common for people not to treat them that way. All of the new docs are gold, but if I could only pick one to recommend that every React developer read, it would be this one
Second is abuse of useState for calculated values