Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Copy and paste this to your snippets.cson file
- # Use by typing 'graph' + enter
- 'graph':
- 'prefix': 'graph'
- 'body': """
- import React from 'react';
- import { Query } from 'react-apollo';
- import gql from 'graphql-tag';
- const query = gql`
- ${2:}
- `;
- const ${1:Component} = () => {
- return (
- <Query query={query}>
- {({ data, loading, error }) => {
- if (loading) {
- return (
- <p>Loading...</p>
- );
- }
- if (error) {
- return (
- <p>There was an error...</p>
- );
- }
- return (
- <div>Data loaded</div>
- );
- }}
- </Query>
- );
- };
- export default ${1:Component};
- """
Add Comment
Please, Sign In to add comment