Fork me on GitHub
#keechma
<
2016-06-24
>
mihaelkonjevic11:06:37

@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

mihaelkonjevic11:06:56

this example is not using keechma forms (yet!)

mihaelkonjevic11:06:00

but the idea is the same

mihaelkonjevic11:06:17

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

bocaj18:06:18

Thanks. That helps.

bocaj18:06:46

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)

bocaj18:06:58

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

mihaelkonjevic18:06:11

yeah, please ask any questions you have 🙂

mihaelkonjevic18:06:15

I’m here to help

bocaj18:06:16

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

bocaj18:06:28

So a delay is to be expect 🙂

bocaj18:06:51

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.

mihaelkonjevic18:06:33

when I started, I had the same feeling

mihaelkonjevic18:06:40

reagent is such an elegant abstraction

mihaelkonjevic18:06:52

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

bocaj18:06:21

Makes sense

bocaj18:06:39

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

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

mihaelkonjevic18:06:16

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

mihaelkonjevic18:06:26

when you call it as function

mihaelkonjevic18:06:34

you will immediately get the result returned

mihaelkonjevic18:06:45

so it’s actually function call vs vector

mihaelkonjevic18:06:20

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

bocaj18:06:51

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

mihaelkonjevic18:06:36

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

bocaj18:06:38

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]

bocaj18:06:00

that's easy to remember

bocaj19:06:00

What if this in the demo

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

mihaelkonjevic19:06:56

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

bocaj20:06:10

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.

mihaelkonjevic20:06:30

ah, makes sense