I think Rum deserves a mention too. I'm not aware of any other Clojure React wrapper that is fully CLJC-compatible, e.g. it allows you to perform server-side rendering in JVM Clojure. Libraries like Reagent require you to use ClojureScript in the backend for the same functionality.
UIX (mentioned in the talk) is CLJC and they have some docs on SSR, though personally I would stick to plain hiccup or selmer if I was doing server side rendering with Clojure. I think trying to do react SSR with CLJC is a bit of a minefield and I would always reach for Astro or Next JS if I really needed both SSR and React. I've tried SSR with Rum and had quite a few issues with it (though this was 5 years ago or so). Just my personal opinion of course, quite possible I was just using it wrong :) Alex
This is really good! I recently had to work on a React codebase and nearly lost my mind. I was however able to use Vite with plain JavaScript instead of Typescript, using Shadow-cljs to compile the cljs parts.
If you're losing your mind working on a react codebase then the codebase is probably the problem. Working with react should feel like a breeze, but unfortunately it can't prevent developers from writing bad code.
I can't blame my coworkers, they were just using the same thing everyone else does, and their code is fine. The fault was all my own, for not ever learning React and frankly not caring to. I was only able to gain traction by stepping away from it as if it was vanilla js, writing my feature, and worrying about the React part later. In the end I was able to just ship an ESM module anyway!
Thanks, Alex! This is a fantastic presentation, from idea to execution. There's something with Reagent that fits for me. I love Hiccup and how that makes it easy to treat my views as data. UIx looks fantastic, and I remember how well it just blended in with Reagent when working with Pitch's client, which was using both (and migrating to UIx if, iiuc). I should take Squint for a spin. What is the REPL story there? Also, with the 1:1 mapping to JS, it seems like maybe you loose some hot replacement of new versions of functions and such might work differently/not as well as with regular ClojureScript?
Yeah a lot of people like the concept of Hiccup and if you have a UI that doesn't suffer from performance issues it's still a great choice. I'm planning on doing a followup video showing my dev environment with squint (hot code reloading, project structure, repl workflow etc) but the short answer is that the REPL story isn't great (see clojurians.slack.com/archives/C8NUSGWG6/p1687801112497799?thread_ts=1687786096.050629&cid=C8NUSGWG6 for more info on why). However I've gotten by ok with a babashka repl (automatic if you use neovim + conjure, not sure about other editors but sure its possible) so I can at least eval and test pure functions inline, and because the compiled js is more readable the standard js tools are always there for debugging live code. The experience is not as good as a standard CLJS REPL but honestly I don't think the standard CLJS REPL is that great anyway (you can't eval react components, inline callbacks need to be extracted and tagged with #' etc)
@@juxt4112 I'm having a great time with the ClojureScript REPL! This is reason alone for me to test Squint and Cherry out, to see how Calva likes it. Generally Calva is very Babashka friendly so at least that kind of workflow should be possible. Looking forward to the followup!
I just watched the video titled Babashka Conf 2023: "Growing an Ecosystem: Lessons Learned (Closing Keynote)" by Michiel Borkent and was pleased to learn that despite the fact that JavaScript's module system is antithetical to achieving the late-binding required for a REPL context, Michiel will not let that stop us.
This is exactly what I needed to hear today. I'm going with standard for now, looking forward to playing with UIx and SquintCLJS. Thank you!
Very valueable ideas. Thanks.
I think Rum deserves a mention too. I'm not aware of any other Clojure React wrapper that is fully CLJC-compatible, e.g. it allows you to perform server-side rendering in JVM Clojure. Libraries like Reagent require you to use ClojureScript in the backend for the same functionality.
UIX (mentioned in the talk) is CLJC and they have some docs on SSR, though personally I would stick to plain hiccup or selmer if I was doing server side rendering with Clojure. I think trying to do react SSR with CLJC is a bit of a minefield and I would always reach for Astro or Next JS if I really needed both SSR and React. I've tried SSR with Rum and had quite a few issues with it (though this was 5 years ago or so).
Just my personal opinion of course, quite possible I was just using it wrong :)
Alex
This is really good! I recently had to work on a React codebase and nearly lost my mind. I was however able to use Vite with plain JavaScript instead of Typescript, using Shadow-cljs to compile the cljs parts.
If you're losing your mind working on a react codebase then the codebase is probably the problem. Working with react should feel like a breeze, but unfortunately it can't prevent developers from writing bad code.
I can't blame my coworkers, they were just using the same thing everyone else does, and their code is fine. The fault was all my own, for not ever learning React and frankly not caring to. I was only able to gain traction by stepping away from it as if it was vanilla js, writing my feature, and worrying about the React part later. In the end I was able to just ship an ESM module anyway!
Thanks, Alex! This is a fantastic presentation, from idea to execution. There's something with Reagent that fits for me. I love Hiccup and how that makes it easy to treat my views as data. UIx looks fantastic, and I remember how well it just blended in with Reagent when working with Pitch's client, which was using both (and migrating to UIx if, iiuc). I should take Squint for a spin. What is the REPL story there? Also, with the 1:1 mapping to JS, it seems like maybe you loose some hot replacement of new versions of functions and such might work differently/not as well as with regular ClojureScript?
Yeah a lot of people like the concept of Hiccup and if you have a UI that doesn't suffer from performance issues it's still a great choice.
I'm planning on doing a followup video showing my dev environment with squint (hot code reloading, project structure, repl workflow etc) but the short answer is that the REPL story isn't great (see clojurians.slack.com/archives/C8NUSGWG6/p1687801112497799?thread_ts=1687786096.050629&cid=C8NUSGWG6 for more info on why). However I've gotten by ok with a babashka repl (automatic if you use neovim + conjure, not sure about other editors but sure its possible) so I can at least eval and test pure functions inline, and because the compiled js is more readable the standard js tools are always there for debugging live code. The experience is not as good as a standard CLJS REPL but honestly I don't think the standard CLJS REPL is that great anyway (you can't eval react components, inline callbacks need to be extracted and tagged with #' etc)
@@juxt4112 I'm having a great time with the ClojureScript REPL! This is reason alone for me to test Squint and Cherry out, to see how Calva likes it. Generally Calva is very Babashka friendly so at least that kind of workflow should be possible. Looking forward to the followup!
Haha, and that was me. I'm getting confused who I am at times...
I just watched the video titled Babashka Conf 2023: "Growing an Ecosystem: Lessons Learned (Closing Keynote)" by Michiel Borkent and was pleased to learn that despite the fact that JavaScript's module system is antithetical to achieving the late-binding required for a REPL context, Michiel will not let that stop us.