Fork me on GitHub

What’s the best approach to a re-frame form edit widget where some of the fields must be rendered from custom objects, like date/time or a money field?


I don't understand what you mean by "be rendered from custom objects". But maybe you can get some ideas from some of the re-com widgets.


Hmm, ok I’ll take a look.


I’m just referring to js objects that need to be formatted in a form field, since they aren’t simple strings or numbers.


So, when to convert them, where to keep the state, when to convert back, etc.


I think it's somewhat obvious: > when to convert them Exactly when you need the converted value. > where to keep the state Where you usually keep the state when you have to deal with just strings and numbers. > when to convert back When you need to update the state.


Well, I thought perhaps it would be easier to deal with one format vs another on the js side. The transit format is great for over the wire, but other types might be better for JS side manipulation. Since I'm new to the transit types, I'm still figuring this out....


Ah, right. Personally, I'm fine with the types that Transit supports. And when I'm not (like it can be with #inst), it's fairly easy to redefine the default read/write handlers to support custom types that you seem as more fit. You don't need to convert the data manually everywhere.