7 ms·
That's almost exactly the path I've gone down, and svelte is something I've been seriously researching for a couple months now. I have a nagging problem that k
by darksaints 6y ago
That's almost exactly the path I've gone down, and svelte is something I've been seriously researching for a couple months now.
I have a nagging problem that keeps coming back to me though. The declarative state model is the holy grail for UI design, but if you try to mix in any form of imperative logic, it all falls apart. All of a sudden you need to understand and plug into poorly documented and opaque component lifecycle APIs in order to insert your imperative code and have it work correctly. And that really messes up the nice clean solution, making it look more like a chimera of two state models.
Some of that is fixed by libraries that create components native to your framework of choice, implementing the appropriate lifecycle hooks as necessary. But now you're relying on a library that adapts one library to another library, and now you've got a dependency sync problem on top of it all.
It wouldn't be such a problem if there weren't so many extremely useful libraries that depend on imperative code. Personally, I've run into massive problems trying to use D3, Leaflet, and Bootstrap, as well as a handful of others. I'm sure there are thousands more.
Not trying to take away from your point. When these declarative state models work well, it's a beautiful thing to behold. But there's always some point where the abstraction leaks.
https://svelte.dev/tutorial/onmount https://svelte.dev/tutorial/onmount
https://reactjs.org/docs/state-and-lifecycle.html https://reactjs.org/docs/state-and-lifecycle.html
https://blog.logrocket.com/introduction-to-vue-lifecycle-hooks/ https://blog.logrocket.com/introduction-to-vue-lifecycle-hoo...
https://mithril.js.org/lifecycle-methods.html https://mithril.js.org/lifecycle-methods.html
- dimfeld 6y agoI wrote some about my experiences using Leaflet with Svelte: https://imfeld.dev/writing/leaflet_with_svelte https://imfeld.dev/writing/leaflet_with_svelte I found you have to do some extra work to keep track of things to convert from declarative style to Leaflet’s imperative style, but overall I actually had a pretty good experience with it. Feel free to ping me on Twitter (same username) if you have any questions.