4 ms·
What kind of functionality is "runs natively in the browser"? JSX also runs in every browser. Edit: Just rename "Web Components" into "Web Tags" and it's all
by auggierose 3y ago
What kind of functionality is "runs natively in the browser"?
JSX also runs in every browser.
Edit: Just rename "Web Components" into "Web Tags" and it's all good.
- selectnull 3y agoI don't know what browser you use, but when I do: const el = <p>Hello, world!</p>; I get `Uncaught SyntaxError: Unexpected token '<'`. I even tried in several browsers, no luck.
- auggierose 3y agoIt seems the problem here is not the browser, but your lack of knowledge.
- dtagames 3y agoYou're just missing two things. First, install Lit. Then write it as: const el = html`<p>Hello, world!</p>` And you're done. These are called "tagged template literals[0]". Lit gives you the html "tag" for the literal that you're looking for. [0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- troupo 3y agoBoth are non-standard DSLs that need an external library to work
- afavour 3y ago1) that’s not JSX, it just looks like it 2) it’s still an external library, which is OPs point
- dtagames 3y agoI don't think Lit counts as a framework. It's much lower-level plumbing. And tagged template literals are part of the browser.
- troupo 3y agoBut lit's DSL isn't a part of the browser. Neither is lit's data binding/reactivity. Nor lit's rules on directives. Nor lit's tasks. Nor lit's context. Nor...
- auggierose 3y agoYes, I would agree with that. And that's why "running natively in the browser" is not a remarkable feature of web components, because you will need something like lit anyway for using web components in a productive way. So you might as well use React, or any of the other billion frameworks.