Last active
April 3, 2018 13:18
-
-
Save kettanaito/a1a24882a08ad9c5e627a3c79a6a88a1 to your computer and use it in GitHub Desktop.
React Advanced Form - Submit
This file contains hidden or 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 { Form } from 'react-advanced-form'; | |
import { Input } from '...'; | |
export default class RegistrationForm extends React.Component { | |
registerUser = ({ serialized, fields, form }) => { | |
return fetch('https://backend.dev/user', { | |
method: 'POST', | |
body: JSON.stringify(serialized) | |
}); | |
} | |
render() { | |
return ( | |
<Form action={this.registerUser}> | |
<Input | |
name="userEmail" | |
type="email" | |
required /> | |
<Input | |
name="userPassword" | |
type="password" | |
required /> | |
</Form> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment