import React, { Component } from 'react'; import { Mutation } from 'react-apollo'; import gql from 'graphql-tag'; import { CURRENT_USER_QUERY } from './User'; import Form from './styles/Form'; import Error from './ErrorMessage'; const SIGNUP_MUTATION = gql` mutation SIGNUP_MUTATION($email: String!, $name: String!, $password: String!) { signup(email: $email, name: $name, password: $password) { id email name } } `; class Signup extends Component { state = { email: '', name: '', password: '', }; saveToState = e => { const { name, value } = e.target; this.setState({ [name]: value }); }; render() { return ( {(signup, { loading, error }) => (
{ e.preventDefault(); const res = await signup(); }} >

Sign Up for an Account

)}
); } } export default Signup; export { SIGNUP_MUTATION };