As I mentioned, my experience is that the benefits aren’t really comparable to what you get with cljs, but I realize that not everybody has the option of using it. So, it’s nice that you get some form of hot loading in js nowadays.
It’s worth noting that cljs toolchain offers a lot of other benefits as well. For example, the compiler does minification and code pruning out of the box. Code pruning works down to function level because the compiler can reliably tell where a function comes from and where it’s used. If you include a library and use single function from it that’s what gets included. The compiler is also able to do things like code splitting based on namespace hierarchy. So, you can trivially break up your app into separate bundles.
All of these things are really important for front-end code since you want to reduce bundle size that’s sent to the browser. And while it’s possible to do a lot of this stuff with js, just as with hot loading it’s not consistent or reliable.
This comparison really illustrates the benefits of the above. ClojureScript with re-frame actually beats React+Redux in performance even though it uses React under the hood. It produces a significantly smaller bundle, and results in second least code out of all the frameworks tested.
ClojureScript does take a bit more up front effort to learn coming from a different family of languages, but I would argue the effort is well worth it. Learning to look at problems from a different perspective is a valuable skill that’s transferable to imperative languages as well. I certainly gained a lot more appreciation of the problems with having shared mutable state after using Clojure. This is something I didn’t even consider when I worked exclusively with imperative languages.
As I mentioned, my experience is that the benefits aren’t really comparable to what you get with cljs, but I realize that not everybody has the option of using it. So, it’s nice that you get some form of hot loading in js nowadays.
It’s worth noting that cljs toolchain offers a lot of other benefits as well. For example, the compiler does minification and code pruning out of the box. Code pruning works down to function level because the compiler can reliably tell where a function comes from and where it’s used. If you include a library and use single function from it that’s what gets included. The compiler is also able to do things like code splitting based on namespace hierarchy. So, you can trivially break up your app into separate bundles.
All of these things are really important for front-end code since you want to reduce bundle size that’s sent to the browser. And while it’s possible to do a lot of this stuff with js, just as with hot loading it’s not consistent or reliable.
This comparison really illustrates the benefits of the above. ClojureScript with re-frame actually beats React+Redux in performance even though it uses React under the hood. It produces a significantly smaller bundle, and results in second least code out of all the frameworks tested.
ClojureScript does take a bit more up front effort to learn coming from a different family of languages, but I would argue the effort is well worth it. Learning to look at problems from a different perspective is a valuable skill that’s transferable to imperative languages as well. I certainly gained a lot more appreciation of the problems with having shared mutable state after using Clojure. This is something I didn’t even consider when I worked exclusively with imperative languages.