4 ms·
It's not hard to be faster than React, React's performance benefit comes from the fact it makes performance easy to understand and optimise rather than just bei
by mambodog 11y ago
It's not hard to be faster than React, React's performance benefit comes from the fact it makes performance easy to understand and optimise rather than just being magically (but opaquely) fast.
However, the real reason React is a good choice is not performance, but rather how it encourages developers to think about, isolate and better manage mutable state in their applications.
- idibidiart 11y agoCorrect. But React is also a step behind ClojureScript based React wrappers :) like Om and Reagent.
- zaynetro 11y agoCould you explain why are they step ahead? I am not familiar with ClojureScript, but my interest in it is really high.
- alejandrodob 11y agoBecause Clojurescript uses immutable data structures, and keeps the state in a centralized atom, so comparing different states is as easy (and fast) as comparing the different versions of the data structure, which in turn (and thanks to being immutable data structures) reduces to compare their memory references, which is fast.
- mbrock 11y agoCentralized state as an immutable data structure is exactly how the app I work with is built. It's plain JavaScript and React. So I don't see how React is "behind" on this front.
- xtrumanx 11y agoImmutable.js is a project also from FaceBook that brings immutable data structures to your JS applications including those using React. Since Clojurescript compiles down to JS, wouldn't it be possible to use Immutable.js and a slightly different app design (a single Flux Store for the entire app) to get the same benefit of using React with Clojurescript?
- lewisl9029 11y agoThe centralized immutable state oriented architecture advocated by Om can definitely be implemented using plain JavaScript (my favorite in this space is https://github.com/moreartyjs/moreartyjs https://github.com/moreartyjs/moreartyjs), but language features like core.async, transducers and macros are not so easily replicated.
- Touche 11y agoNitpicking but ClojureScript the language does not keep state in a centralized atom. That's just a common pattern used for Reagent/Om apps.
- woah 11y agoNuclear.js also does this, with pretty idiomatic JavaScript
- deleted 11y ago[deleted]
- MikeOfAu 11y agoThis is a slightly long read, but it will give you a feel for it: https://github.com/Day8/re-frame https://github.com/Day8/re-frame (disclosure: I am the author)
- smrtinsert 11y ago100% agreed. Working now on angular app at work (not my choice) I see state flying everywhere which will inevitably lead to something awful. The argument to push it back into a main controller and let it flow downward only seems completely unrealistic if not impossible and the api certainly doesn't encourage it at all. Meanwhile in Clojurescript I have undo functionality without thinking about it - mind blowing because it's something I never expected to see in a web app without much pain.
- gcb0 11y agocare to share how react is transparent? it's completely opaque on how it decides to re render the dom. unless you only have react code there, it's completely dark magic for other code