This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-22
Channels
- # announcements (4)
- # babashka (10)
- # beginners (25)
- # biff (4)
- # calva (22)
- # clj-on-windows (3)
- # clj-otel (1)
- # clojure (17)
- # clojure-europe (5)
- # clojure-gamedev (2)
- # clojure-norway (1)
- # clojurescript (21)
- # conjure (5)
- # core-async (3)
- # defnpodcast (1)
- # deps-new (8)
- # events (3)
- # graalvm (10)
- # graphql (4)
- # gratitude (2)
- # hyperfiddle (7)
- # introduce-yourself (4)
- # jobs (1)
- # membrane (9)
- # pedestal (5)
- # quil (2)
- # re-frame (7)
- # releases (2)
- # rewrite-clj (14)
- # shadow-cljs (8)
- # tools-deps (5)
Hi there, read through the docs and am looking to start creating my app and was wondering if there's a strategy for dealing with client app state using biff and it's many components. In my case I have a page that will have many text areas with some additional info that a user can attach to them and the user can add as many as possible before actually performing any crud operation on it.
the general approach is to keep client side state as lean as possible and ideally within the DOM. you could take a look at the docs for htmx (https://htmx.org/) and Hyperscript (https://hyperscript.org/); biff doesn't add anything on top of them. and of course you can always add in some plain Javascript if needed. I do that every now and then. in this case, the easiest thing might be to have an Add button that triggers an htmx request, so you can render a new block of input fields on the server and insert them into the DOM. however that would introduce a needless network request and the associated latency. so I might just use plain Javascript to render and insert the fields. in either case, a Remove button could be implemented with Hyperscript pretty easily.
To clarify, do you mean plain old JavaScript in the static js file for the site? No clojurescript?
yeah, that's what I mean. You can use clojurescript, but you'll have to wire it up yourself; biff doesn't provide cljs out of the box.