在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):charlypoly/react-apollo-form开源软件地址(OpenSource Url):https://github.com/charlypoly/react-apollo-form开源编程语言(OpenSource Language):TypeScript 97.9%开源软件介绍(OpenSource Introduction):<ApolloForm>Build React forms based on GraphQL APIs. see this ticket for updatesThe library is currently under active rewriting, pleaseGetting started: build a GraphQL Form in 5 minutesTo get started more easily, please readPre-requisites
Optionally
InstallationInstall package
Add script to your project
{
"scripts": {
"react-apollo-form": "react-apollo-form fetch-mutations <graphql_endpoint> <outpurDir>"
}
}
This script will generated 3 files needed by
Tips: you can change the output directory of theses with the second argument or UsageOnce 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
To get started more easily, please read Getting started: build a GraphQL Form in 5 minutes The following subjects are specific to
Q&A
Yes, just setup multiple scripts in your project
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 ArchitectureGeneralThe idea is to build forms using mutations from the GraphQL API.
It brings some "embed" features:
GraphQL to JSON SchemaSee graphql-2-json-schema package. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论