hey there, is there an example for keechma/next that shows how to use it with reagent?
@nha I’m definitely following trends here 😄
@beders not right now, but it shouldn’t be too hard. There are two options: 1. Sync whole state to the reactive atom and then use reagent’s reactions to implement subscriptions and similar features 2. Use keechma’s subscription system and sync subscriptions with reagent Option 1 is not possible atm - there is no way to sync whole state, but option 2 should be very easy to implement. I can create an example tomorrow
How are you guys currently rendering an UI?
We are using the Helix library. Here’s the integration https://github.com/retro/keechma-next-realworld-app/blob/master/src/keechma/next/helix/core.cljs
This repo has all the code that will be extracted and released over next few weeks, it needs to be cleaned up and documented
Ah, ok, so you are using hooks.
for Helix, the integration is done through hooks
Thanks for posting this
I'll check out helix
can't say if I'm a fan of hooks yet or not, but I definitely like keechma controllers
For us they are a great solution because we get closer integration with React, and we’re handling reactivity on our own now anyway, so Reagent is an overkill. If you want to try it out real quickly with reagent something like this might work:
(defn my-comp []
(reagent/with-let [local-state (reagent/atom nil)
unsubscribe (keechma/subscribe app-instance :controller-name #(reset! local-state %)]
...
(finally
(unsubscribe))))
oh, right, yeah, that's a neat approach
thanks so much!
No problem, please mention me when you have a question, I’ll try to answer ASAP. I’m checking this channel periodically, but this will ensure I see it sooner 🙂
will do! I guess I need to read up on what react was up to since invention of hooks 😉