News for hackers. Stuff that matters.
Re:Alpine.js: A minimal framework for composing JavaScript b... by strogonoff on Tuesday February 11, 2020 @05:58AM (#22297547)
I believe making proper sense of FCs and the seemingly arbitrary at first glance rules of hooks requires knowing the underpinnings of how hooks get called.

In class-based components “didMount”, “willReceiveProps”, “willUnmount” et al. would be more or less intuitive to a newcomer with just a general idea of how it works.

That I believe makes FCs fundamentally more complex to learn from scratch.

Personally having some experience I go with FCs if there’s a new complex front-end project that is based on React, but I use class-based components if I need to sprinkle a few on a mostly static website that may have to be maintained by someone else.

(Class-based components in a basic case, which would be the case in question, are also quite straightforward to convert to FCs.)

There are no comments on this comment yet.