top | item 32804204

(no title)

licyeus | 3 years ago

I built a text annotation tool recently, first in React before rewriting it in Svelte. I found React's virtual DOM annoying, esp. when dealing with text selections + wrapping those selections with elements, etc. Svelte was just simpler in this regard (and overall, IMO).

But if you're not a frontend dev and want to use lots of off-the-shelf components, Svelte's ecosystem is much smaller than React's, so you won't have access to full-featured component libraries like MUI, Chakra, etc. Additionally, Typescript support is stronger in React (it's mostly there in Svelte, but lacking in some areas [1]).

For both React and Svelte I found XState helpful to manage annotator state. It might not be necessary if your app isn't terribly complex (in particular, Svelte's built-in stores can handle complex state well), but I've found it a good way to think about state+events and more confidently make changes as a result.

1 - https://github.com/sveltejs/svelte/issues/4701

discuss

order

cpfohl|3 years ago

I think it’s worth nothing that pretty much any vanilla js library works out of the box with svelte with very little extra effort. Don’t discount the size of that ecosystem