Hey hello. I would like to ask if you can share some tips on cljs/re-frame frontend development. I have started on my own using the re-frame-template
and the experience so far hasn't been great (or, should I say, I'm struggling 🙂).
For example, can you recommend some good router for the front? It seems like secretary
, which is recommended by the re-frame-template
is considered basic/not recommended (my opinion is based on this post: https://purelyfunctional.tv/mini-guide/clojure-routers/). Seems like reitit is the way to go, but the documentation is not super clear on how to start with CLJS. Should I just use https://github.com/metosin/reitit/blob/master/examples/frontend-re-frame as my template for the project or is there some kind of a starter/scaffold/boilerplate for re-frame based projects (other than the aforementioned leiningen template)?
If what I'm asking about seems obvious, could you point me out to some learning resources or examples of frontend cljs apps "implemented by the book", i.e. decent quality frontend written in cljs?
Have a good day everybody 🙂
@rberger Great stuff, thank you. I will check it out 👍
not a template, but kee-frame is quite "batteries included", you might want to check it out
I would strongly advise against using any sort of templates/scaffolding. IMO they're a great tool to help you when you already know all you need to know about different components and they're quite bad if you're just learning things. FWIW I use bidi for some projects and reitit for others. Cannot really say anything about quality, but here's a nice list of projects that use Clojure: https://github.com/kaxap/arl/blob/master/README-Clojure.md
Re-frame repo has lists of all kinds of resources https://github.com/day8/re-frame/blob/master/docs/External-Resources.md As @p-himik mentioned, it’s recommended to start from the simplest possible setup and add pieces one by one. It’s quite hard in the beginning and requires a lot of work but it’ll pay off. It’s more common in CLJ/CLJS that people form their own set of opinions about the libraries and use them as needed. What comes to re-frame, I can warmly recommend starting with the example in the #reitit repo. I might be a bit biased because I’m the original author of the example. 😄 You can also drop any questions here or in #beginners if you get stuck. There are also a few projects that aim to provide a “batteries included” setup, such as #luminus
Ok, thanks for your help guys :)
I find that getting started with secretary is easier than reitit on the frontend. If you feel the same, I recommend starting off with secretary, then later if you feel limited by it and you've gained more experience, migrate to reitit. I have migrated a re-frame project from secretary to reitit before, and it's not really a substantial task.
Not sure on the routing, but I've got to say that I've found templates (re-frame and luminus) super helpful. Maybe it depends on your learning style. I like to jump into something that already kinda works and then learn how it works as I change it, and I don't mind that some of it is "magic" to begin with. As I get more experience I gradually understand how the templates are put together and the patterns behind them.
@jtlocsei I do find the templates useful. I think the problem is that I am trying to find feature parity with react/js workflow instead of spending time on learning the cljs way. Basically, I need patience and practice and I should be fine (I guess) 🙂
As someone who started off with create-react-app, I can understand how you feel. There is no single cljs template with an army of contributors behind it; actually this would be against "clojurian culture".
I find it helpful having some template to overcome the “blank page problem”. I’ve been using a https://github.com/omnyway-labs/cljs-shadow-devcards-template based on one by @filipematossilva https://github.com/filipesilva/create-cljs-app But it gives just the minimal shadow-cljs based setup for Reagent and devcards. No routing or re-frame. But those are easy to add.