Earlier quoted context omitted.
But React isn't just JSX. It's also the entire runtime library, hooks, event handling, forms, state handling, etc. The example you shared is a bit too simple to understand where Svelte shines because it doesn't introduce any of those concerns. By having it's own templating language, Svelte is able to compile the templates to JavaScript in a way that addresses many of those concerns in a way that I think it easier to…
Not to mention it takes reactivity to new heights while adding amazingly little actual syntax. When property changes, the fetch refires, loading appears until the fetch resolves then it displays whatever array someFetch resolved to. I came from Vue and that plus the way Svelte does stores (literally nothing special about them) was a breath of fresh air. {#await someFetch(property)} Loading... {:then data} {#each data…
div
Await promise={mypromise}
div Loading…
{res => res.map(…)}
div Error: {err => err.message}
(writing in pug-like because I can’t stand closing these tags on the phone)Isn’t it easier in both react and vue to create Await component with children=(ifwaiting, ifresolved, ifrejected) than suffering all over the code?
Edit: I messed data flow up in the error handler, wontfix but you get the idea