Fork me on GitHub
#re-frame
<
2020-10-25
>
Rafał Wyszomirski08:10:16

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 🙂

p-himik09:10:56

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

👍 2
valtteri10:10:40

Re-frame repo has lists of all kinds of resources https://github.com/day8/re-frame/blob/master/docs/External-Resources.md As @U2FRKM4TW 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

👍 1
Rafał Wyszomirski10:10:36

Ok, thanks for your help guys :)

👌 1
uosl12:10:29

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.

👍 1
tobias12:10:39

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.

Rafał Wyszomirski13:10:30

@UA9399DFZ 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) 🙂

uosl13:10:26

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".

rberger21:10:22

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 @UJVKWJTGE 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.

❤️ 1
Rafał Wyszomirski08:10:24

@U07GPFFAS Great stuff, thank you. I will check it out 👍

seqable20:10:14

not a template, but kee-frame is quite "batteries included", you might want to check it out

👍 1