add proptypes to signup form

This commit is contained in:
catarak 2016-06-27 13:54:50 -04:00
parent 2bdd682771
commit 7a07d5380d

View file

@ -1,10 +1,9 @@
import React from 'react'; import React, { PropTypes } from 'react';
class SignupForm extends React.Component { function SignupForm(props) {
render() { const { fields: { username, email, password, confirmPassword }, handleSubmit } = props;
const { fields: { username, email, password, confirmPassword }, handleSubmit } = this.props;
return ( return (
<form className="signup-form" onSubmit={handleSubmit(this.props.signUpUser.bind(this))}> <form className="signup-form" onSubmit={handleSubmit(props.signUpUser.bind(this))}>
<p className="signup-form__field"> <p className="signup-form__field">
<label className="signup-form__username-label" htmlFor="username">Username:</label> <label className="signup-form__username-label" htmlFor="username">Username:</label>
<input <input
@ -54,6 +53,16 @@ class SignupForm extends React.Component {
</form> </form>
); );
} }
}
SignupForm.propTypes = {
fields: PropTypes.shape({
username: PropTypes.string.isRequired,
email: PropTypes.string.isRequired,
password: PropTypes.string.isRequired,
confirmPassword: PropTypes.string.isRequired
}).isRequired,
handleSubmit: PropTypes.func.isRequired,
signUpUser: PropTypes.func.isRequired
};
export default SignupForm; export default SignupForm;