News for hackers. Stuff that matters.
Re:How I made a website with Svelte by csande17 on Saturday December 28, 2019 @01:44PM (#21900768)
In your first example, if invokeFunction() returns 0, the text "0" will be inserted into the page. 0 is falsey, so `0 && <p>Hi</p>` evaluates to 0, but 0 is a number so React pastes it into the page contents.

React has footguns like this because JavaScript expressions were not designed to be used as a templating language.

Re:How I made a website with Svelte by hombre_fatal on Saturday December 28, 2019 @01:59PM (#21900888)
Thinking your function returns a boolean when it returns an int seems like another issue entirely, like habitually depending on implicit conversion like "==". If that's a common issue for a team, maybe it's time to look into Typescript. Seems like a very minor reason to use a whole new DSL with a whole new set of warts for all of your templating.