Created
September 9, 2017 21:22
-
-
Save KTruong008/eb63912a85e2877e90253147cc1a65fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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