Created
July 24, 2016 05:05
-
-
Save RealDeanZhao/41f8211d463e99210b01ae6644b35736 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
// a Form | |
class FormBase extends React.Component<any, {}>{ | |
render() { | |
return ( | |
<form onSubmit={this.props.handleSubmit}> | |
<div> | |
<label>Username</label> | |
<Field component='input' className="form-control" type="text" placeholder="First Name" name='username'/> | |
</div> | |
</form> | |
) | |
} | |
} | |
export const Form = reduxForm({ | |
form: 'form' | |
})(FormBase); | |
// The component with a Form | |
class OuterBase extends React.Component<any, {}>{ | |
// the values will be passed from the inner Form component, so we can do some dispatching here. | |
handleSubmit = (values: any): any => { | |
const {dispatch} = this.props; | |
const {username, password} = values; | |
dispatch(); | |
} | |
render() { | |
return ( | |
<div> | |
<Form onSubmit={this.handleSubmit} /> | |
</div> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment