I\'ve got a plain react-redux-powered form. I wish for there to be a form.container.tsx and a form.component.tsx, where form.container.tsx holds all the connections to redux
I also ran into this issue trying to initialise my form from redux state, as per the example in https://redux-form.com/7.0.4/examples/initializefromstate/
I ended up getting around it by connecting the component at a higher level, eg:
component.tsx:
interface DummyFormComponentProps {} extends InjectedFormProps
const DummyFormComponent: React.SFC = props => {
return (
)
}
export const DummyForm = reduxForm({
form: "dummy-form"
})(DummyFormComponent)
// Trying to connect here also gave errors with DecoratedComponentClass
container.tsx:
interface DummyFormContainerProps {} extends Pick
const submitForm = (formValues: object) => {
alert(formValues);
};
const DummyFormContainer: React.SFC = props => {
return (
)
}
const mapStateToProps = (state: State) => ({
initialValues: {}
});
const mapDispatchToProps = (dispatch: object) => {
return {};
};
export default connect(mapStateToProps, mapDispatchToProps)(DummyFormContainer)