DEV Community

Discussion on: Why I moved from React to Svelte and others will follow

blowpurp profile image
Avon Barksdale • Edited on

It's real HTML, not JSX that looks like HTML



Is this a new incredibly ugly way to define inline JS? Is that a...pipe in there?


Never seen that HTML attr before 🤔

kelerchian profile image

More accurate critic would be: svelte is not html at all.

Rich Harris introduce this language as htmlx

If it has different parser from html, it is a different language.

mikenikles profile image
Mike Nikles Author

Hi Avon,

Thanks for your feedback.

The on:submit|preventDefault syntax is optional. We could use the regular event.preventDefault(); call in the handleSubmit() function to keep the HTML cleaner.

In case of the htmlFor, thanks for pointing that out. I copied the initial source code from the React website to make sure I don't miss any feature in the Svelte version. I've updated the blog post and the interactive demo to use for.

blowpurp profile image
Avon Barksdale

Good to know; appreciate you clarifying!