- Podcasts
- Programmers
- 🔥 Lit vs React
About this episodeThe differences between lit and react
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
🔥 Lit vs React
Leet and react. Lit and react are two popular libraries for building web components and web applications while both have their strengths and weaknesses. There are some key differences between them that may make one more suitable for your project. Then the other one major difference between leaked and react is the underlying technology lit is built on top of web components, which is a set of Of web standards that allows developers to Define their own HTML elements. So it's actually web components.
It's more, it's clothes to web components in contrast. We Act is built on top of JavaScript and utilizes a virtual Dom to efficiently update, the UI leads use of web components means that it is highly interoperable with other libraries and Frameworks. The to use the same standards as we said, the lead will be more compatible with web components and walk out of the box, and this will make lit easier to integrate with other parts of the applications or to use web components created by others. Additionally, because lead is built on web standards. It is likely to remain stable and compatible with future versions of web Technologies.
Reacts use of the virtual Dome and its focus on JavaScript, make it very performant and efficient, the virtual Dome allows the ark to update the UI quickly. And only update a parts of the page that have changed resulting in smoother, user experience. The ACT focus on JavaScript. Also means that it has a large and active community of developers, which can make it easier to find resources and get Plead any issues. Another key difference between lead and react is their approach to templates.
Lead users a syntax called template literals that allows you to Define HTML directly in your JavaScript code. This can make it easier to create and meant components and can also make it easier to share code between components react. On the other hand, uses JS 6 syntax that allows you to Define your HTML in a separate file, which some developers find easier to work with. In terms of size lead is generally smaller than react, which can make it easier to use in smaller projects. Auto include in larger projects without significantly, increasing the overall size of the application, both lead and react have stone communities and active development. So we are likely to find good resources and support for either Library.
Ultimately the choice between lead and react will depend on our specific project needs and requirements. If we need high performance, And efficient updates, or if you are already using a JavaScript heavy application, then the ACT may be the better choice. If what we mainly need and are concerned with is interoperability with other web, standards and Technologies, then we may prefer the simpler syntax of defining our HTML and in this case and Lead Maybe The better choice. And so Soul.
It is comparable to the act in many ways and we can use lit of course to build websites web apps, you eyes lit will even do something that react can do. For example, it uses typescript out of the box. It's not required, but it encourages it's encouraged. Also in react, we can use typescript, but we need to invest sometimes enabling it.
Lit, components are class-based and they encapsulate State and behavior, just like react components, and both lead and reactor component-based. And we can create more complex, you Eyes by composing our components together. When the components State changed and dif will reflect this exact state. Because of the emphasis toward leaning and the bothers that already offers components, then lit is really tiny liable. It's about 5, KB.
A lot of heavy lifting is done in lead by - voiceover API instead of by additional framework boilerplate. That we'd also be downloaded. But they are both component-based as we said, Lead components are class-based. So if class syntax is not our thing, then it's less. The thing that we that we want, but lit uses typescript out of the box, as we said web components in general.
