Comment

Comment by codeptualize

Why are so many comments about class components, I thought we ended that debate 3 years ago?

Hooks are better because they allow you to reuse component logic, impossible with class components. They solve all the issues and gotcha's of HOC's.

Don't compare class components with hooks, compare HOC's with hooks.

The best way to grow appreciation for hooks is to try wrapping many HOC's and deal with conflicting props and "innerRefs". People seem to very easily forget the horrors of the old.

Also lets be real, hooks aren't that bad. Yes dependencies arrays and useEffect take some getting used to, but I rarely get into situations where I actually get into questionable territory. Use react-query/swr for fetching, use Zustand (or whatever) for state, and you cut out 95% of the problems.

Anyway, the new docs are great, well done, nice work!

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton