re: Svelte is the most beautiful web framework I've ever seen VIEW POST

FULL DISCUSSION
 

From Svelte docs: "You can use reserved words as prop names."

Can you provide an example of when you would want to use a reserved word as a prop name? Or when it would be unavoidable?

I've never had issues avoiding reserved words for a variable name, so I'm intrigued by this particular feature. Thanks!

 

React forces you to write <div className="asdf" /> as opposed to <div class="asdf" /> and <label htmlFor="asdf" /> instead of <label for="asdf" />. This is because class and for both have intrinsic meaning in Javascript, and when JSX was first created they were worried that reusing this naming could cause problems. (My understanding is that they now believe that class and for would have been fine in the first place...)

I'm pretty sure that bit in the Svelte docs is saying that those renamings aren't necessary in Svelte.

 

You're asking the newest user of Svelte so I'm really not sure. Maybe someone else has an example?

 
code of conduct - report abuse