DEV Community

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

Collapse
 
blowpurp profile image
Avon Barksdale • Edited

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

Really?

on:submit|preventDefault

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

htmlFor

Never seen that HTML attr before 🤔

Collapse
 
kelerchian profile image
Alan

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

Rich Harris introduce this language as htmlx github.com/htmlx-org/HTMLx.

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

Collapse
 
mikenikles profile image
Mike

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.

Collapse
 
blowpurp profile image
Avon Barksdale

Good to know; appreciate you clarifying!