Skip to content

andyp22/gql-imports

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gql-imports

A boilerplate package for graphql queries, fragments, mutators, and etc written with TypeScript using the graphql-tag package. Add your queries or whatever to ts/src and run then compile before committing.

  • To compile to JS: npm run compile

Sample Query Definition

From ts/src/gqlQueries.ts:

import gql from 'graphql-tag';

export const gqlQueries = {
  me: gql`
    query Me {
      me {
        id,
        firstName
      }
    }
  `,
};

To Install

Add the following to your package.json:

"devDependencies": {
  "gql-imports": "andyp22/gql-imports"
}

Then:

npm install

Usage Example

import { graphql } from 'react-apollo';
import { gqlQueries } from 'gql-imports';

export class HomePage extends React.Component { ... }

export default graphql(gqlQueries.me)(HomePage);

About

A boilerplate package for graphql queries, fragments, mutators, and etc

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published