Skip to content

Instantly share code, notes, and snippets.

@adrianhall
Created December 17, 2018 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adrianhall/e97ead2c6d742d49fc6f9afb5481925b to your computer and use it in GitHub Desktop.
Save adrianhall/e97ead2c6d742d49fc6f9afb5481925b to your computer and use it in GitHub Desktop.
public async componentWillMount() {
try {
const result = await API.graphql(graphqlOperation('{ me { id name } }'));
console.log('componentWillMount: result = ', result);
this.setState({ loading: false, data: result.data.me });
} catch (err) {
this.setState({ loading: false, errors: [ err.message ] });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment