Reputation: 8580
Does anyone know how to set global defaults for redux-form's reduxForm() HOC?
For example, say I would like every redux-form instance in my app to use the following option:
reduxForm({touchOnChange: true})
Maybe I'll need to monkeypatch redux-form itself but I'm not quite sure how to do that either.. Thanks!
Upvotes: 0
Views: 46
Reputation: 41440
There's no way to do this. But you don't need a built-in way to set defaults.
Simply implement a customReduxForm
function, and always use it instead of the one from redux-form
package:
import { reduxForm } from 'redux-form';
export const customReduxForm = options => reduxForm({
propNamespace: 'form',
touchOnChange: true,
initialValues: { userId: 123 },
...options,
})
Upvotes: 2