keechma

Keechma stack. Mention @U050986L9 or @U2J1PHYNM if you have any questions
mihaelkonjevic 2016-06-24T11:01:37.000028Z

@bocaj Forms are intentionally separated from the rest of keechma. The idea is to use the send-command function from the UI layer to send the form results to the controller

mihaelkonjevic 2016-06-24T11:01:56.000031Z

this example is not using keechma forms (yet!)

mihaelkonjevic 2016-06-24T11:02:00.000032Z

but the idea is the same

mihaelkonjevic 2016-06-24T11:02:17.000033Z

then you can do whatever you want with the data in the controller layer

bocaj 2016-06-24T18:36:18.000034Z

Thanks. That helps.

bocaj 2016-06-24T18:37:46.000035Z

I was also figured out that form and inited-form are distinct. Duh:) So, in my render function I'm passing

inited-form
not
form
(defn render [ctx] ... (render-login-form inited-form)

bocaj 2016-06-24T18:37:58.000036Z

I'm a beginner, so hoping this feedback is useful.

mihaelkonjevic 2016-06-24T18:38:11.000037Z

yeah, please ask any questions you have 🙂

mihaelkonjevic 2016-06-24T18:38:15.000038Z

I’m here to help

đź‘Ť 1
🦜 2
bocaj 2016-06-24T18:39:16.000039Z

Great! I'm on the US west coast...you're in Poland, yes?

mihaelkonjevic 2016-06-24T18:39:26.000040Z

Croatia

bocaj 2016-06-24T18:39:28.000041Z

So a delay is to be expect 🙂

bocaj 2016-06-24T18:46:51.000042Z

So, why do you think this is easier for me to pick up than, say, untangled-web and om.next . The hiccup syntax feels more familiar for some reason.

mihaelkonjevic 2016-06-24T18:48:33.000043Z

when I started, I had the same feeling

mihaelkonjevic 2016-06-24T18:48:40.000044Z

reagent is such an elegant abstraction

mihaelkonjevic 2016-06-24T18:48:52.000045Z

I really like that components are only a function, not a macro

bocaj 2016-06-24T18:49:21.000047Z

Makes sense

bocaj 2016-06-24T18:50:39.000048Z

Can you explain or point me to when to call a component in a vec vs a list

[render-stuff x]
(render-stuff x)

mihaelkonjevic 2016-06-24T18:51:16.000049Z

so those are not the same, when in vec reagent will actually mount it as a component

mihaelkonjevic 2016-06-24T18:51:26.000050Z

when you call it as function

mihaelkonjevic 2016-06-24T18:51:34.000051Z

you will immediately get the result returned

mihaelkonjevic 2016-06-24T18:51:45.000052Z

so it’s actually function call vs vector

mihaelkonjevic 2016-06-24T18:52:20.000053Z

I use function calls for helper like functionality, small extractions that are actually part of the bigger components

bocaj 2016-06-24T18:53:51.000054Z

Ok. So for a rule of thumb/heuristic use a vector to mount a component at "app" level, and functions to build things up at "my-component" level

mihaelkonjevic 2016-06-24T18:54:36.000055Z

yeah, you could put it like that. My rule of thumb is, if it’s in the same file make it a function, otherwise it’s probably a component (unless you have a file with bunch of helpers :))

bocaj 2016-06-24T18:55:38.000056Z

oh, that makes sense. So, you use "c-my-component" in a let bind with (ui/component ctx ...) , then you'd probably use [c-my-component]

mihaelkonjevic 2016-06-24T18:55:49.000057Z

yes

bocaj 2016-06-24T18:56:00.000058Z

that's easy to remember

bocaj 2016-06-24T19:29:00.000059Z

What if this in the demo

(def form  (f/constructor validator))
were
(def form-fn  (f/constructor validator))
or new-form

mihaelkonjevic 2016-06-24T19:31:56.000060Z

I don’t really understand the question, but to explain how the f/constructor works - it has two arities one where you call it with the validator only (f/constructor validator) and one where you call it with the validator, data and opts (f/constructor validator data opts) if you call it with the validator only, it will return a function that can be used to create a form “instance” - where you pass it data and opts later. This way you can bind form to the validator and pass it around as one thing

bocaj 2016-06-24T19:53:55.000061Z

Got it.

bocaj 2016-06-24T20:26:10.000062Z

I was trying to say, that in the demo you could rename the var to form-fn to indicate what the var type was. You pass around "form" as params in the rest of the demo, which is a form-instance.

mihaelkonjevic 2016-06-24T20:32:30.000063Z

ah, makes sense