Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How about the lit-html template

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report