4 ms·
At least for current Web Component API, no. Html is good because it's declarative, but it's not good since it lack abstraction. So React combine JSX template a
by namelosw 8y ago
At least for current Web Component API, no.
Html is good because it's declarative, but it's not good since it lack abstraction. So React combine JSX template and lambda as declarative component. Means you have parametrized template and loop etc.
Vanilla and jQuery is not so good because it's not reactive by default, which means you're not always describing things you want, instead you have to update something. Eventually you will forget some. It's called imperative.
Current Web Components spec include attribute changed hooks but it's far from React since most of the APIs are imperative.
But why declarity matters? Because it turns out front-end world is totally different from request-response backend programming. Because in front-end you're dealing with continuous sequence of signals instead of one off requests. Declarative style makes you describe the relation between model, views and derived values, not how to update or maintain those relations.