One area where the virtual DOM seems to be important is for rich text editors, where the VDOM can basically take the input, diff it using an immutable structure, then render it to properly structured HTML. An example use case where this would be valuable: a user hightlights text, bolds it, then highlights it again plus some more text, and bolds it. A naive approach would have: This text is bolded plus I bolded this w…
Svelte 3: Rethinking Reactivity
41–50 of 186 posts
Re: Svelte 3: Rethinking Reactivity
#42I'm not sure I like this single components approach and embedding JS in HTML.
The problem with this is that it's too frameworkish.
The big benefit of JSX/React rendering is that it's composable and declarative (as it's just functions), but it's also simple to get - render just returns wanted structure, given the state and you can use simple assert to verify that.
Solutions like angular/vue/svelte rely on custom template parsing which IMO sucks, because it's hard to extend/test without specific template compilers. JSX in contrast is embracing language.
I think that render functions written like in react and data reactivity is the simplest approach to describe application. Seems like VueJS with JSX is closest to this right now.
It would be cool to keep similar API but maybe use compiling to have smaller bundle/older browsers support/different platform support etc.
To be clear by similar API I mean just pure JSX components, where you plugin reactive data, that could be tested without any frameworks and without rendering. This is the simplest way, yet nobody build it yet - MobX + pure React components is close to this (problem is that still rendering is done by React, so rendering isn't most performant - depends on components hierarchy) - with compilation/integration you could make it more performant, but I would keep declararive nature and simplicity of JSX.
Re: Svelte 3: Rethinking Reactivity
#43One area where the virtual DOM seems to be important is for rich text editors, where the VDOM can basically take the input, diff it using an immutable structure, then render it to properly structured HTML. An example use case where this would be valuable: a user hightlights text, bolds it, then highlights it again plus some more text, and bolds it. A naive approach would have: This text is bolded plus I bolded this w…
Rich text editing is possibly a special case, though the right person to ask about that would be Jacob Wright ( https://github.com/jacwright ). He's the creator of https://www.dabblewriter.com (which uses Svelte) and a Svelte contributor, so he probably knows more about this topic than just about anyone else!
Re: Svelte 3: Rethinking Reactivity
#44I'm really impressed that the release announcement starts by explaining what Svelte is. It's a little thing, but it's appreciated.
Tell me how you intend it to be used and I’ll see if that matches what I think I want (miss-wanting a different topic!).
Re: Svelte 3: Rethinking Reactivity
#45From the tutorial: > Svelte is giving us a warning: > A11y: element should have an alt attribute > When building web apps, it's important to make sure that they're accessible to the broadest possible userbase, including people with (for example) impaired vision or motion, or people without powerful hardware or good internet connections. Accessibility (shortened to a11y) isn't always easy to get right, but Svelte will…
Re: Svelte 3: Rethinking Reactivity
#46Nice handling of reactivity - I think this should already be in language as well. I'm not sure I like this single components approach and embedding JS in HTML. The problem with this is that it's too frameworkish. The big benefit of JSX/React rendering is that it's composable and declarative (as it's just functions), but it's also simple to get - render just returns wanted structure, given the state and you can use si…
This is actually a feature, considering what Svelte does. I know of more than a few efforts to implement similar compile-time production of low level procedural code from React components, but so far nobody's been quite able to do it. And this is despite these efforts coming from some very smart people. The reason this is so hard to do for React is precisely because Javascript is a huge target with a ton of bizarre quirks and edge cases.
> To be clear by similar API I mean just pure JSX components, where you plugin reactive data,
I think Solid.js is the closest thing to this atm. Not React-based though.
Re: Svelte 3: Rethinking Reactivity
#47"The magical disappearing UI framework" was a much better tagline than "Cybernetically enhanced web apps" …
Re: Svelte 3: Rethinking Reactivity
#48Re: Svelte 3: Rethinking Reactivity
#49Re: Svelte 3: Rethinking Reactivity
#50Their interactive tutorial with sandboxes is really impressive. That's a great onramp into actual usage. It might also be cool to have a good way to "eject" the sandbox into a functional local build.