Reputation: 71
For various reasons that are not my call, in my work application, we are using redux
without the connect HOC
. There are pros and cons here. But is it possible to use redux-form
in this manner, currently I have redux-form1 using it's own store via
connect()`, which means it's less than ideal, there is at times state being passed between the two stores, the single source of truth is lost.
Is there any way I can use redux-form
without using the connect HOC
?
Upvotes: 4
Views: 811
Reputation: 195
You can use reduxForm HOC. If you are using
semantic-ui-react,
then u can wrap fields by using <Form.Field>
Upvotes: 0
Reputation: 328
Redux forms uses reduxForm
instead of connect, Here is an example.
NewCampaignForm.propTypes = {
fields: PropTypes.object.isRequired,
handleSubmit: PropTypes.func.isRequired,
resetForm: PropTypes.func.isRequired,
submitting: PropTypes.bool.isRequired
}
export default reduxForm({
form: 'new-campaign-form',
fields
})(NewCampaignForm);
And if you did want to, you could use connect
on the parent container of that form, and it would work.
Upvotes: 0