keechma

Keechma stack. Mention @U050986L9 or @U2J1PHYNM if you have any questions
beders 2020-07-25T20:24:15.029900Z

hey there, is there an example for keechma/next that shows how to use it with reagent?

mihaelkonjevic 2020-07-25T21:54:24.030500Z

@nha I’m definitely following trends here 😄

🙂 1
mihaelkonjevic 2020-07-25T21:56:46.033Z

@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

beders 2020-07-25T21:58:31.033700Z

How are you guys currently rendering an UI?

mihaelkonjevic 2020-07-25T21:59:24.034200Z

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

mihaelkonjevic 2020-07-25T21:59:57.035300Z

This repo has all the code that will be extracted and released over next few weeks, it needs to be cleaned up and documented

beders 2020-07-25T22:00:11.035800Z

Ah, ok, so you are using hooks.

mihaelkonjevic 2020-07-25T22:00:13.036Z

for Helix, the integration is done through hooks

beders 2020-07-25T22:00:15.036100Z

Thanks for posting this

beders 2020-07-25T22:00:24.036300Z

I'll check out helix

beders 2020-07-25T22:00:52.037Z

can't say if I'm a fan of hooks yet or not, but I definitely like keechma controllers

mihaelkonjevic 2020-07-25T22:03:46.039900Z

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))))

👍 1
beders 2020-07-25T22:04:49.040500Z

oh, right, yeah, that's a neat approach

beders 2020-07-25T22:05:14.040900Z

thanks so much!

mihaelkonjevic 2020-07-25T22:06:07.041900Z

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 🙂

beders 2020-07-25T22:06:53.042700Z

will do! I guess I need to read up on what react was up to since invention of hooks 😉