Skip to content

Instantly share code, notes, and snippets.

@kettanaito
Last active April 3, 2018 13:18
Show Gist options
  • Save kettanaito/a1a24882a08ad9c5e627a3c79a6a88a1 to your computer and use it in GitHub Desktop.
Save kettanaito/a1a24882a08ad9c5e627a3c79a6a88a1 to your computer and use it in GitHub Desktop.
React Advanced Form - Submit
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