0.1.5 β€’ Published 5 years ago

@bam.tech/react-native-graphql-transformer v0.1.5

Weekly downloads
441
License
MIT
Repository
github
Last release
5 years ago

react-native-graphql-transformer

All Contributors

Seamlessly use GraphQL files with react-native >= 0.45

Foreword

This package is inspired by the react-native-typescript-transform repository.

Goal

Use .gqlor .graphql files with React Native packager for better readability and separation of concerns.

Exemple of a .gql file with import statement:

#import "fragments/BasePost.gql"

query PostListItemQuery($id: ID) {
  Post(id: $id) {
    ...BasePost
  }
}

Usage

Step 1: Install

yarn add -D react-native-graphql-transformer

Step 2: Configure the react native packager

Add this to your rn-cli.config.js (make one if you don't have one already):

const { getDefaultConfig } = require('metro-config');

module.exports = (async () => {
  const { resolver: { sourceExts } } = await getDefaultConfig();
  return {
    transformer: {
      babelTransformerPath: require.resolve('@bam.tech/react-native-graphql-transformer'),
    },
    resolver: {
      sourceExts: [...sourceExts, 'gql', 'graphql'],
    },
  };
})();

Step 3: Write GraphQL code!

Contributors

Thomas PucciπŸ’» πŸ“– πŸ’‘TychoTaπŸ’»ClΓ©ment TaboulotπŸ’»arolson101πŸ’‘ajubinπŸ’»Gerard de BriederπŸ›

License

MIT

0.1.5

5 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.0.1

6 years ago