Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The 'Mustaches' bit killed it for me, but up until then I was enjoying the simplicity of the API. I like React (and React-like implementations) because of being able to use JS to build up a view


Yeah, same. Can't give up JS/TS templating and typesafety. simply for a smaller size, I already use something that is way, way smaller than react.


I'm curious, what do you use?


In the past, I used virtual-dom. It works fine, but it's discontinued and doesn't address the problem of encapsulated component state. Now using this: https://github.com/AlexGalays/kaiju/


We should do a better job of clarifying: this isn't Mustache-the-language, it's just using {{ and }} as delimiters. The syntax is simpler than Mustache, and allows you to use any inline JavaScript expression, which will become fully reactive.


Er, can you explain further with an example? I'm confused about using both something like {{#if}} and pure JS


See e.g. http://bit.ly/2fRcyJq. The {{#if ...}} part is a control flow directive that allows Svelte to understand the structure of your app, but the condition of that if block is just a JS expression


But it's limited to if, else, and elseif expressions?


Yep. For me React JSX simplifies component building.


React also uses curly braces for interpolation, not that different.


I would imagine that he meant the control-structure stuff like {#if}, rather than pure JS.


Yeah I interpreted his comment to be about syntax. OTOH React (JSX) lacks these control structures inline in the templates, it has to be done in separate steps, not a clear win for all situations.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: