All Projects → wittydeveloper → React Apollo Form

wittydeveloper / React Apollo Form

Licence: mit
Build React forms based on GraphQL APIs.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to React Apollo Form

react-apollo-form
Build React forms based on GraphQL APIs.
Stars: ✭ 195 (+9.55%)
Mutual labels:  apollo, forms, form, graphql-api
Villus
🏎 A tiny and fast GraphQL client for Vue.js
Stars: ✭ 378 (+112.36%)
Mutual labels:  graphql, apollo, graphql-api
Searchkit
GraphQL API & React UI components for Elasticsearch. The easiest way to build a great search experience
Stars: ✭ 4,338 (+2337.08%)
Mutual labels:  graphql, apollo, graphql-api
Countries
🌎 Public GraphQL API for information about countries
Stars: ✭ 156 (-12.36%)
Mutual labels:  graphql, apollo, graphql-api
Apollo
Meteor & Apollo integration
Stars: ✭ 87 (-51.12%)
Mutual labels:  graphql, apollo, graphql-api
Sqldatasource
SQL DataSource for Apollo GraphQL projects
Stars: ✭ 176 (-1.12%)
Mutual labels:  graphql, apollo
Reactql
Universal React+GraphQL starter kit: React 16, Apollo 2, MobX, Emotion, Webpack 4, GraphQL Code Generator, React Router 4, PostCSS, SSR
Stars: ✭ 1,833 (+929.78%)
Mutual labels:  graphql, apollo
Next Graphql Blog
🖊 A Blog including a server and a client. Server is built with Node, Express & a customized GraphQL-yoga server. Client is built with React, Next js & Apollo client.
Stars: ✭ 152 (-14.61%)
Mutual labels:  graphql, apollo
Portara
Portara directive is a rate limiter / throttler for GraphQL
Stars: ✭ 158 (-11.24%)
Mutual labels:  graphql, apollo
Reason Apollo Hooks
Deprecated in favor of https://github.com/reasonml-community/graphql-ppx
Stars: ✭ 140 (-21.35%)
Mutual labels:  graphql, apollo
Reactconfbr
Public infos and issues about React Conf Brasil organization
Stars: ✭ 156 (-12.36%)
Mutual labels:  graphql, apollo
Ran
⚡ RAN! React . GraphQL . Next.js Toolkit ⚡ - SEO-Ready, Production-Ready, SSR, Hot-Reload, CSS-in-JS, Caching, CLI commands and more...
Stars: ✭ 2,128 (+1095.51%)
Mutual labels:  graphql, apollo
Meteor Apollo Accounts
Meteor accounts in GraphQL
Stars: ✭ 145 (-18.54%)
Mutual labels:  graphql, apollo
Graphql Directive
Use custom directives in your GraphQL schema and queries 🎩
Stars: ✭ 142 (-20.22%)
Mutual labels:  graphql, apollo
Hangzhou Graphql Party
杭州 GraphQLParty 往期记录(slide,照片,预告,视频等)
Stars: ✭ 142 (-20.22%)
Mutual labels:  graphql, graphql-api
Core
The Form Tools Core.
Stars: ✭ 156 (-12.36%)
Mutual labels:  form, forms
Graphql Rails Blog
Blog App built with Rails 5, React and GraphQL
Stars: ✭ 160 (-10.11%)
Mutual labels:  graphql, apollo
Fielder
A field-first form library for React and React Native
Stars: ✭ 160 (-10.11%)
Mutual labels:  form, forms
Scalable React Typescript Boilerplate
⭐️ Scalable micro-framework featuring React and TypeScript
Stars: ✭ 174 (-2.25%)
Mutual labels:  graphql, apollo
Frisky
🍿 Open Source GraphQL API for Online Shows
Stars: ✭ 161 (-9.55%)
Mutual labels:  graphql, graphql-api

<ApolloForm> https://img.shields.io/circleci/project/github/wittydeveloper/react-apollo-form.svg https://img.shields.io/npm/v/react-apollo-form.svg https://img.shields.io/npm/dt/react-apollo-form.svg

Build React forms based on GraphQL APIs.


The library is currently under active rewriting, please see this ticket for updates


https://s3.eu-west-2.amazonaws.com/github-oss/react-apollo-form/read-me-demo-preview.png


To get started more easily, please read Getting started: build a GraphQL Form in 5 minutes


Pre-requisites

Optionally


Installation

Install package

  • install yarn add react-apollo-form

Add script to your project

  • add to your package.json, at the scripts section :
{
    "scripts": {
        "react-apollo-form": "react-apollo-form fetch-mutations <graphql_endpoint> <outpurDir>"
    }
}

This script will generated 3 files needed by <ApolloForm>:

  • schema.json (GraphQL Introspection Query result as JSON)
  • mutations.d.ts (all available mutations names as TypeScript type definition)
  • apollo-form-json-schema.json (GraphQL Schema as JSON Schema)

Tips: you can change the output directory of theses with the second argument or -o option


Usage

Once the files generated, we can setup a Form.

import * as React from 'react';
import gql from 'graphql-tag';
import { configure } from 'react-apollo-form';
import { client } from './apollo';
import { applicationFormTheme } from './core/forms/themes/application';


const jsonSchema = require('./core/apollo-form-json-schema.json');

export const ApplicationForm = configure<ApolloFormMutationNames>({
    // tslint:disable-next-line:no-any
    client: client as any,
    jsonSchema,
    theme: applicationFormTheme
});

<ApplicationForm
    config={{
        mutation: {
            name: 'create_todo',
            document: gql`mutation {...}`
        }
    }}
    data={{}}
/>

API

ApolloForm is based on the amazing Mozilla library react-jsonschema-form. Most of the questions regarding JSON Schema, validations or rendering are in react-jsonschema-form documentation

To get started more easily, please read Getting started: build a GraphQL Form in 5 minutes

The following subjects are specific to ApolloForm:


Q&A

  • Can I make ApolloForm works with many GraphQL endpoints?

Yes, just setup multiple scripts in your project package.json with one output folder per endpoint, then just configure a "component form" for each endpoint

  • Where can I find some documentation about widgets, fields or theming in general?

Please take a look at the react-jsonschema-form documentation that will answers 90% of the rendering questions. If not, please take a look at Theming


Architecture

General

The idea is to build forms using mutations from the GraphQL API.

ApolloForm is "just" a wrapper around react-jsonschema-form.

It brings some "embed" features:

  • JSON schema generation from GraphQL Schema
  • conditionals forms
  • form rendering customisation with render props
  • build JSON Schema with functions (with functional-json-schema)

GraphQL to JSON Schema

See graphql-2-json-schema package.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].