Guest User

Untitled

a guest
Dec 12th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. # Copy and paste this to your snippets.cson file
  2. # Use by typing 'graph' + enter
  3. 'graph':
  4. 'prefix': 'graph'
  5. 'body': """
  6. import React from 'react';
  7. import { Query } from 'react-apollo';
  8. import gql from 'graphql-tag';
  9.  
  10. const query = gql`
  11. ${2:}
  12. `;
  13.  
  14. const ${1:Component} = () => {
  15. return (
  16. <Query query={query}>
  17. {({ data, loading, error }) => {
  18. if (loading) {
  19. return (
  20. <p>Loading...</p>
  21. );
  22. }
  23.  
  24. if (error) {
  25. return (
  26. <p>There was an error...</p>
  27. );
  28. }
  29.  
  30. return (
  31. <div>Data loaded</div>
  32. );
  33. }}
  34. </Query>
  35. );
  36. };
  37.  
  38. export default ${1:Component};
  39. """
Add Comment
Please, Sign In to add comment