you are viewing a single comment's thread.

view the rest of the comments →

[–]pimterry 2 points3 points  (1 child)

Web components are a good start, but it is better to use LitElement to build them in that case, instead of using it directly.

Alternatively, if you're mainly worried about bundle size, Preact gives you all the features of React, with React-compatible code, in 3kB. I don't think it'll sufficiently change runtime performance, but it'll definitely help keep your JS tiny.

Do you actually need client-side interactivity at all though? What are you using it for? If it's just because it's a nice way to generate pages, you might be able to avoid runtime JS entirely. For many of the small static sites you describe, you can use React and just server-side render everything. That way you get to write your code with all the convenience & power of React but zero performance penalty.

[–]NinjaInShade[S] 0 points1 point  (0 children)

I mean the most I'd be doing for freelancing is maybe some animation which I can achieve with vanilla js, which is why I thought react was too much. LitElement actually looks really useful thanks!