Skip to content

Instantly share code, notes, and snippets.

@KTruong008
Created September 9, 2017 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KTruong008/eb63912a85e2877e90253147cc1a65fc to your computer and use it in GitHub Desktop.
Save KTruong008/eb63912a85e2877e90253147cc1a65fc to your computer and use it in GitHub Desktop.
import React from 'react';
import { connect } from 'react-redux';
import { reduxForm, getFormValues } from 'redux-form';
import FormComponent from './form.component';
export const FormContainer = props => {
const submitForm = (formValues) => {
console.log('submitting Form: ', formValues);
}
return (
<FormComponent
formValues={props.formValues}
change={props.change}
onSubmit={submitForm}
handleSubmit={props.handleSubmit}
/>
);
}
const mapStateToProps = state => ({
formValues: getFormValues('my-very-own-form')(state),
});
const formConfiguration = {
form: 'my-very-own-form',
}
export default connect(mapStateToProps)(
reduxForm(formConfiguration)(FormContainer)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment