Fork me on GitHub
#reagent
<
2017-04-28
>
rgdelato01:04:44

does anyone else have an answer for this? I would also like to know if there is a "Clojure" way to serialize a form

grav11:04:02

If you have a clj(s) datastructure and just want to serialize it, it’s often just a matter of using pr-str, eg (pr-str {:foo 42 :bar "hello"})

grav11:04:41

To deserialize it, you can then use cljs.reader/read-str or clj.core/read-str

grav11:04:15

Regarding capturing data, the idiomatic way of doing it in React (and Reagent) is to use controlled components, as described here: https://facebook.github.io/react/docs/forms.html

rgdelato17:04:32

It's a bit of a longer topic, but there are definitely reasons to use uncontrolled inputs in a lot of cases. (Hopefully React Fiber will help with controlled input perf.) In my JS work, I tend to default to uncontrolled inputs unless there's a reason not to.