Lit: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
[https://lit.dev/ Lit] is a library to write web components which are similar to a browser-based version of React. | [https://lit.dev/ Lit] is a library to write web components which are similar to a browser-based version of React. | ||
==Usage== | |||
===Events=== | |||
With Lit, data flows down DOM elements and events flow up DOM elements. This is unlike React where callback handlers are use to pass data up the DOM tree. | |||
===React interop=== | |||
See https://lit.dev/docs/frameworks/react/ for how to use lit components within React components. | |||
There's no simple way to use React inside a webcomponent. You will need to wrap it inside a webcomponent. | |||
See https://stackoverflow.com/questions/66970860/creating-pure-web-component-from-react-components and https://github.com/bitovi/react-to-web-component |
Revision as of 07:22, 30 March 2025
Lit is a library to write web components which are similar to a browser-based version of React.
Usage
Events
With Lit, data flows down DOM elements and events flow up DOM elements. This is unlike React where callback handlers are use to pass data up the DOM tree.
React interop
See https://lit.dev/docs/frameworks/react/ for how to use lit components within React components.
There's no simple way to use React inside a webcomponent. You will need to wrap it inside a webcomponent. See https://stackoverflow.com/questions/66970860/creating-pure-web-component-from-react-components and https://github.com/bitovi/react-to-web-component