logoalt Hacker News

aatd86today at 10:25 AM1 replyview on HN

For me it is the opposite. I dislike having imperative constructs pollute my otherwise declarative markup. To each their own I guess.


Replies

zarzavattoday at 2:07 PM

Don't you still have imperative constructs if you use Svelte? It's not like any web framework can remove the need to render things conditionally.

If you have `{#if cond}`, that's imperative programming, not declarative, it's just imperative programming using a different syntax.

Using a different syntax for a conditional/loop depending on the type of the data is odd when you think about it. Why should vnodes use one syntax and every other data type use another syntax?

I will grant that the C ?: ternary operator syntax is ugly. If C had had expression based if/else like Rust then maybe people wouldn't mind JSX so much.

show 1 reply