Are reagent-forms meant to be using with re-frame?
Asked Answered
S

2

10

I'm building an application with re-frame and I'm wondering if reagent-form are meant to be used with re-frame or not, as reagent-form brings in its own way of handling state which is different than re-frame.

Sihon answered 8/10, 2015 at 18:22 Comment(0)
S
8

After experimenting a bit, I'd say it can be used, by completely ignoring the ratom that reagent-forms use for state and just using the callback, as in:

[bind-fields [form-template ...] default-values
               (fn [_ _ doc]
                 (re-frame.core/dispatch [:update-data doc]))]

but to me, it didn't feel right, ignoring that ratom with state. That's why I created a new library called Free-form for creating forms with Reagent and optionally, with Re-frame.

Free-form doesn't store state, it just has a similar callback mechanism and it comes with a layer that makes it plugging it into Re-frame straightforward (but optional). On top of that, it makes no assumptions about the shape of your form, you are in total control of your HTML.

Sihon answered 11/10, 2015 at 12:31 Comment(0)
W
1

You can, but I think you shouldn't.

One thing you could do is just require twitter bootstrap and do some glueing to use everything in the re-frame way.

Wie answered 9/10, 2015 at 15:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.