Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save takahirohonda/092cea436a36a2da26a1994fff4813f9 to your computer and use it in GitHub Desktop.
Save takahirohonda/092cea436a36a2da26a1994fff4813f9 to your computer and use it in GitHub Desktop.
refactoring-react-es6-class-components-with-property-initialisers-3
const Form = ({state, onInputHandler, onSubmitHandler}) => {
return (
<form>
<label for="firstname">First name</label>
<input
type="text" name="firstname" id="firstname"
onChange={e => onInputHandler(e.target.name, e.target.value)}
/>
<label for="id">Id</label>
<input
type="text" name="firstname" id="firstname"
onChange={this.idInputHandler}
/>
<button type="submit" onSubmit={() => onSubmitHandler()}>
{state.submitButtonTitle}
</button>
</form>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment