P
P
partyzanx2021-12-20 23:45:25
JavaScript
partyzanx, 2021-12-20 23:45:25

Do web components render instantly?

I correctly understood that web components (I'm talking about the browser API, and not about the framework components) are kind of cached, so when you reload the page, if it is all made of web components, then a blank screen will not appear first, and then the content site (no blinking?). And if you just create an element directly and insert it into the DOM, will it blink?

I'm just thinking whether to use "web components + stimulus" on the site or use "regular html elements + stimulus"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Dubrovin, 2021-12-21
@alekcena

Web components is the creation of your own tag based on js.
If you insert code after the tag declaration, it will not be valid.
Consequently, js code execution is not cached -> every time it creates them anew.
They won't blink. You need to put the code for the components before the HTML markup using them.
Why do you need web components, what task are you solving that you cannot do without basic ones?
Do not forget that there are many more settings in the base components than it seems. (Semantics, Ability to switch, Settings for devices for reading.)
If you do something, then it is to expand the basic ones. (Inherit from them)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question