Im trying to use this code to pass a dynamic form name into reduxForm.
Here is the code that I found:
let FormAddress = compose(connect((state, props) => ({form: props.form})), reduxForm({destroyOnUnmount: false, asyncBlurFields: []}))(ValidationForm);
From this article: https://github.com/erikras/redux-form/issues/603#issuecomment-254271319
But I'm not really sure whats going on.
This is how I'm currently doing it:
const formName = 'shippingAddress';
const form = reduxForm({
form: formName
});
export default connect(mapStateToProps)(CityStateZip);
But I would like to be able to pass it in using props, like this:
const formName = 'shippingAddress';
const form = reduxForm({
form: props.form
// validate
});
export default connect(mapStateToProps)(CityStateZip);
But when I try that, it complains that it doesnt know what props is - because I believe it's outside the scope of the function above.
Can someone help me?