3.0.1 • Published 6 years ago
@stellar-apps/apollo v3.0.1
@stellar-apps/apollo
This package contains react-apollo utilities and components
Installation
yarn add @stellar-apps/apollo
Usage
import {MutationForm, MutationButton} from '@stellar-apps/apollo'MutationForm
A render props component for easily implementing a react-apollo-based Mutation form using Formik. No
fetch polyfill is provided because the assumption is you're already implementing such a thing with
your Apollo implementation.
Props
In addition to the props below, it inherits props from Formik and react-apollo Mutation
confirm {func}- If defined, the mutation will only run if this function returns
true - Receives two arguments
(formikValues, formikBag)seen here
- If defined, the mutation will only run if this function returns
prepareUpdate {func}- default
({variables}) => ({variables}) - Should return an object to send to the
react-apollomutate()function. See here for details on additional options. By default this returns the
{values}fromFormikas{variables}
- default
Render function
children(<formik>, <mutationResult>)formikmutationResult- See Mutation result here
MutationButton
A wrapper for SpinnerButton above and react-apollo/Mutation
Props
In addition to the props below, this component also receives props for SpinnerButton above and
react-apollo Mutation
confirm {func}- If defined, the mutation will only run if this function returns
true - Receives two arguments
(formikValues, formikBag)seen here
- If defined, the mutation will only run if this function returns
prepareUpdate {func}- default
({variables}) => ({variables}) - Should return an object to send to the
react-apollomutate()function. See here for details on additional options. - By default this returns the
{values}fromFormikas{variables}
- default