How about the lit-html template
This article mainly shows you "lit-html template how", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "lit-html template how" this article.
An efficient, expressive and extensible html template library for JavaScript. The lit-html template is a simple JavaScript that combines the familiarity of html writing with the power of JavaScript. Lit-html is responsible for effectively rendering templates to DOM, including updating DOM effectively with new values.
How about the lit-html template
Import {html,render} from'lit-html'; / / Thisisalit-htmltemplatefunction.Itreturnsalit-htmltemplate. ConsthelloTemplate= (name) = > html`Hello ${name}! `; / / ThisrendersHelloStevebacks to the document body render (helloTemplate ('Steve'), document.body); / / ThisupdatestoHelloKevinarians the ${name} part render (helloTemplate (' Kevin'), document.body)
How to evaluate lit-html
Lit-htmlhasfourmaingoals:EfficientupdatesofpreviouslyrenderedDOM.ExpressivenessandeasyaccesstotheJavaScriptstatethatneedstobeinjectedintoDOM.StandardJavaScriptwithoutrequiredbuildsteps,understandablebystandards-complianttools.Verysmallsize. Simple translation, four goals: fast rendering DOM (comments: performance comparison is not real hammer, "performancebenchmarkingisjuststarting", personal judgment is still very worried about the re-rendering performance of the middle and background, C-side rendering should be OK, similar to artTemplate) it is easy to connect to the state management tool (comment: this is good, reduces the coupling of the framework If you want to use responsive (Mobx) or immutable (Redux) state management tools, you don't need a build tool (comments: it means low browser compatibility, future-oriented technologies) very small size (comments: more suitable for C-side) overall benefits are not great.
The above is all the content of this article "how to lit-html template". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!