Nothing Special   »   [go: up one dir, main page]

2.0.2 • Published 6 years ago

super-form-wrapper v2.0.2

Weekly downloads
14
License
-
Repository
github
Last release
6 years ago

super-form-wrapper

Creates a configurable component wrapper for Apollo Query and Mutation. Form Agnostic! Move Faster.

NPM JavaScript Style Guide

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/>
        )}
      />
    )
  }
}

License

© dangerdespain

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago