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.
re-frame is an application framework for creating more complex single page applications [SPAs] in ClojureScript, using Reagent and [hiccup] style description for generating content.
From OO to Clojure Workshop! Re-frame is the most popular frontend framework for ClojureScript. It is built on Reagent, and thus React. Re-frame adds a beneficial amount of structure to build and maintain your frontend applications.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With