apollo.macro
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

preval.macro

NPM version NPM downloads

This is a babel-plugin-macros plugin.

just make babel-plugin-apollo-helper easier to use.

usage

input:

import { graphql } from '@apollo/react-hoc';
import { autoInjectGql } from 'apollo.macro';

export default autoInjectGql(props => {
  return (
    <div>
      <span>1</span>
    </div>
  );
});

export const query = gql`
  query queryDemo {
    a {
      b
    }
  }
`;

output:

import { graphql } from '@apollo/react-hoc';

export default graphql(
  gql`
    query queryDemo {
      a {
        b
      }
    }
  `,
  {
    name: 'query'
  }
)(props => {
  return (
    <div>
      <span>1</span>
    </div>
  );
});

more usages can see babel-plugin-apollo-helper's test

Package Sidebar

Install

npm i apollo.macro

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

2.98 kB

Total Files

5

Last publish

Collaborators

  • yoyooyoooyoooo