Hacker News new | ask | show | jobs
by tarjei_huse 1625 days ago
I love Svelte and find it refreshing.

The only thing I react to is the part about "It feels much like Rust vs. C++. Rather than adding layers upon layers to existing infinitely backwards-compatible software, it takes the best patterns and features and builds them from the ground up.".

Svelte bungled this in one place and that is in the html coding. For example Svelte has different syntax for if ({#if}, else ({:else}) and endif ({/if}. I end up looking this up in the documentation way too often - especially when not doing Svelte fulltime.

3 comments

I initially preferred JSX ("it's just Javascript"), esp. with Svelte oddities like `$$props`, but after working with Svelte templating for a while I now prefer it due to things like property shorthand and event forwarding.

Re: `:else` syntax, I also made mistakes (`#` and `/` were familiar having worked with Handlebars/Mustache) until I internalized that `:` meant block continuation (also used with await/then/catch).

I use Svelte full-time and absolutely love it, but I do have to admit I sometimes wonder what lead to the decision of {#if}{:else}{/if}, {#each}{/each}, etc syntax. Seems like there had to be less verbose, more consistent approach... But, I'm probably not fully-aware of the constraints and missing something.

I sometimes miss the brevity of the React way (which can also be good and bad) for handling conditional code-blocks {visible && <Component>} or {visible ? <Component1 /> : <Component2 />}

Why not use a snippet that will write it for you?