News for hackers. Stuff that matters.
Re:Alpine.js: A minimal framework for composing JavaScript b... by dragonwriter on Monday February 10, 2020 @11:15AM (#22290375)
> For a minimal start there’s no need to adopt JSX, wrap your head around hooks and functional components, or deal with Webpack configuration.

Unless you've already learned React with class components and lifecycle methods, I suspect it simpler to just not learn them and learn functional components and hooks. It's extra stuff to wrap your head around if you learned the old way first, sure, but it's not fundamentally more complex on its own.

Re:Alpine.js: A minimal framework for composing JavaScript b... by Scarbutt on Thursday February 13, 2020 @06:59PM (#22322613)
I suspect it simpler to just not learn them and learn functional components and hooks.

The official react docs and tutorial don't help here since it introduces class components first.

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.)