I'm migrating from Redux Form to React Final Form on a project that's using React and redux-saga. A common pattern for initializing forms in the project looks like this:
import { initialize } from "redux-form";
import { call } from "redux-saga/effects";
// ...
const data = yield call(axios.get, "/backend/api/endpoint");
yield initialize("someFormName", data);
// ...
Is there a way to do something similar for Final Form?
Creating an object in the store, setting it from the saga and passing it to Final Form's initialValues
prop works, but I suspect it's not the optimal solution, and I'd rather not create a store for every single form in the application.
If you can get your initial values all the way into the initialValues
prop of <Form/>
, then yes. How you connect()
up your component to do so is up to you.