Generate react proptypes from graphql schema
npm i graphql2props
import graphql2props from 'graphql2props'
import { readFileSync } from 'fs'
const code = graphql2props(readFileSync('schema.graphql').toString())
npx graphql2props schema.graphql > props.js
You might have to tune the output a bit (custom scalars aren't supported, for example.) but you can use the props like this:
import React from 'react'
import { Type1, Type2 } from './props'
const MyThing = ({ propA, propB }) => (<div>COOL</div>)
MyThing.propTypes = {
propA: Type1,
propB: Type2
}