3 ms·
The ideas of svelte are great. It reminds me of snabbdom thunks and inferno blueprints. If you know the view code ahead of time, you could do plenty of perf opt
by nojvek 7y ago
The ideas of svelte are great. It reminds me of snabbdom thunks and inferno blueprints. If you know the view code ahead of time, you could do plenty of perf optimizations since you exactly what changes and what to react to.
But sometimes I dynamically generate vdom nodes. Like markdown to vdom. There vdom shines. It’s a simple elegant idea.
I think svelte is exaggerating a bit.
React and vdom family of libraries are great. Svelte is great too. Not mutually exclusive.
Someone should write a Babel jsx transpiler that does svelte like compile time optimizations for react. At the same time still allows dynamic runtime diffing if needed.
No reason why we can’t have best of both worlds.
- acemarke 7y agoThe React team (and other parts of Facebook) _was_ working on a project along those lines called "Prepack": https://prepack.io/ https://prepack.io/ I think work on that has slowed for the time being, but it's got some interesting possibilities.
- fnordsensei 7y agoI do this with React all the time as well, though via ClojureScript and Re-frame[1], in which nodes are represented as plain Clojure data structures. E.g., send an article from the server, formatted in EDN/Hiccup[2][3]. Insert it into a component in the frontend, and it's converted to VDOM nodes. No further logic or conversion required. [1]: https://github.com/Day8/re-frame https://github.com/Day8/re-frame [2]: https://github.com/edn-format/edn https://github.com/edn-format/edn [3]: https://github.com/weavejester/hiccup/wiki/Syntax https://github.com/weavejester/hiccup/wiki/Syntax
- palerdot 7y agoI just noticed that Reframe README is very amusing and wickedly hilarious in some parts. It is very refreshing to read compared to other bland/formal/techinical READMEs ... Maybe in future I will try and see if using Reframe itself is joyful like its Readme ...
- fnordsensei 7y agoOnce you get into it, it's very good. It wrinkled my brain at first though. It does include a bit more ceremony than plain Reagent, which means the app should be sufficiently advanced for the benefits to outweigh the overhead. My rule of thumb is to start with Reagent, and as soon as I notice the desire to wrap and abstract away plain atom swaps, I switch over to re-frame. Re-frame is largely an abstraction over atom swaps, and guaranteed to be better than the half-baked, 10% coverage of the Re-frame functionality that I would end up with if I did it myself. Migrating from Reagent to Re-frame doesn't have to be done in one huge refactoring. It can be done by introducing re-frame into your app function by function.