super-form-wrapper
v2.0.2
Published
Creates a configurable smart component wrapper. Query, Mutation, & Form Provider Agnostic! Move Faster.
Downloads
4
Readme
super-form-wrapper
Creates a configurable component wrapper for Apollo Query and Mutation. Form Agnostic! Move Faster.
Install
npm install --save super-form-wrapper
Usage
import React, { Component } from 'react'
import { Query, Mutation } from 'apollo'
import SuperForm from 'super-form-wrapper'
class Example extends Component {
render () {
return (
<SuperForm
queryProps={()=>({ Query })}
makeMutationProps={(queryResponse)=>({ Mutation })}
makeFormProps={(queryResponse, mutate, mutationResponse)=>({ Form : Formik })}
children={({ mutationResponse })=>(
<Fragment/>
{ ...component or form children here as a function, e.g. {(extendedProps)=><ChildComponent/>
} }
<Fragment/>
)}
/>
)
}
}