import React, { Component } from 'react'; import { Mutation, ApolloConsumer } from 'react-apollo'; import { SIGNUP_MUTATION, CURRENT_USER_QUERY } from '../queries/queries.graphql'; import Form from './styles/Form'; import Error from './ErrorMessage'; class Signup extends Component { state = { email: `wesbos@gmail.com`, name: 'Wes Bos', password: 'wes', }; saveToState = e => { const { name, value } = e.target; this.setState({ [name]: value }); }; render() { return ( {client => ( {(signup, { loading, error }) => (
{ e.preventDefault(); const res = await signup(); // TODO can we return theuser from signup? client.query({ query: CURRENT_USER_QUERY, fetchPolicy: 'network-only' }); }} >

Sign Up for an Account

)}
)}
); } } export default Signup;