Is there any way to have a dynamic form name for redux-form?
reduxForm({
form: `${dynamicFormNameHere}`,
})(Component)
Note: Container = Smart Component, Component = Dumb Component
Currently I have a container (e.g. FilterContainer) that wrap a component with fields, and I use that container in several components. Examples:
// UserComponent.jsx
...
render() {
...
<FilterContainer dynamicName="UserFilterForm" { ... } />
}
// ProductComponent.jsx
...
render() {
...
<FilterContainer dynamicName="ProductFilterForm" { ... } />
}
and inside FilterContainer
mapStateToProps() { ... }
mapDispatchToProps() { ... }
let FilterContainer = connect(
mapStateToProps,
mapDispatchToProps,
)(reduxForm({
form: `${dynamicName from props}`
}}(FilterComponent))
That dynamicName from props is what I wanted to achieve.