apollo.macro
v0.0.3
Published
a babel macros plugin, auto inject grahql query with apollo hoc
Downloads
4
Maintainers
Readme
preval.macro
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