Better decorators for Apollo and React
MIT License
Better decorators for Apollo and React.
3 decorators that work on top of Apollo default decorator and make you code in a more declarative way.
@withGraphQL(query, options)
Use this decorator to make GraphQL query
.
Differences with apollo's graphql
decorator:
data
prop of the component, you get each query variable as a prop.import withGraphQL from 'react-apollo-decorators/lib/withGraphQL'
graphql
decorator.@withMutation(mutation, options)
Use this decorator to make GraphQL mutation
.
Differences with apollo's graphql
decorator:
mutate
prop, you get it as the name you gave it.mutate
function are the variables, the seconds are the options.import withMutation from 'react-apollo-decorators/lib/withMutation'
graphql
decorator.@dynamicQuery(getQuery, options)
Use this decorator to make queries that change with props.
import dynamicQuery from 'react-apollo-decorators/lib/dynamicQuery'
graphql
decorator.