keechma 2016-06-24

@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

this example is not using keechma forms (yet!)

but the idea is the same

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

Thanks. That helps.

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)

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

yeah, please ask any questions you have 🙂

I’m here to help

👍 1
🦜 2

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

Croatia

So a delay is to be expect 🙂

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.

when I started, I had the same feeling

reagent is such an elegant abstraction

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

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

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

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

when you call it as function

you will immediately get the result returned

so it’s actually function call vs vector

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

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

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

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]

that's easy to remember

What if this in the demo

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

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

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.

ah, makes sense