This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-04-24
Channels
- # announcements (8)
- # babashka (16)
- # beginners (18)
- # biff (4)
- # calva (18)
- # clj-kondo (20)
- # clojure (24)
- # clojure-brasil (1)
- # clojure-europe (13)
- # clojure-nl (1)
- # clojure-norway (35)
- # clojure-uk (3)
- # clojurescript (16)
- # core-async (50)
- # cursive (5)
- # data-science (5)
- # datalevin (5)
- # datomic (69)
- # dev-tooling (18)
- # fulcro (3)
- # gratitude (1)
- # honeysql (5)
- # hyperfiddle (4)
- # jackdaw (2)
- # jobs-discuss (24)
- # lambdaisland (7)
- # lsp (16)
- # malli (5)
- # off-topic (65)
- # overtone (16)
- # pathom (28)
- # portal (3)
- # re-frame (24)
- # releases (1)
- # shadow-cljs (101)
Hello! I’m pretty new to the clojure web dev landscape, and biff is looking super promising! I was wondering how to properly reuse clojure functions to return common components, but not have to do “prop drilling” (eg passing data through several nested functions to a leaf level function that is reused everywhere). I come from react.js land and there’s the Context api that helps avoid a lot of the extra boilerplate that comes with prop drilling, but was wondering if I am missing some capability of biff or hiccup Any help would be appreciated!
welcome! I'm not super familiar with the context api other than having done a bit of googling, but I think the equivalent would be adding stuff to Biff's ctx
map. ctx
is generally passed down to all/most components anyway, so if you assoc
things on to it (possibly with a namespace keyword to keep things organized) you typically won't have to do much extra work to then makes sure your leaf components have access to ctx
.
a more principled but heavier approach would be to use https://pathom3.wsscode.com/ . your components can all become pathom resolvers and then query for what they need. pathom can take a bit to learn though and may be overkill in some cases. I'm planning to experiment with it + biff soon.