@shopify/react-form-state
Manage react forms tersely and type-safe with no magic.
Last updated 2 years ago by shopify-dep .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @shopify/react-form-state 
SYNC missed versions from official npm registry.

@shopify/react-form-state

Build Status License: MIT npm version npm bundle size (minified + gzip)

Manage React forms tersely and type-safely with no magic.

This library is now superseded by @shopify/react-form as it allows you to write the preferred, functional, and hooks-driven React components over class-based ones.

Installation

$ yarn add @shopify/react-form-state

Usage

<FormState />

The default component exported by this library is <FormState />.

import FormState from '@shopify/react-form-state';
// Fields here refers to the inferred type of your initialValues object
interface Props<Fields> {
  initialValues: Fields;
  validators?: Partial<ValidatorDictionary<Fields>>;
  onSubmit?: SubmitHandler<Fields>;
  validateOnSubmit?: boolean;
  children(form: FormDetails<Fields>): React.ReactNode;
}

Its only mandatory props are initialValues and children. The initialValues prop is used to infer all the types for the rest of the component, and to generate handlers and field state objects. The children prop expects a function of the current state of the form, which is represented by a FormDetails object.

<FormState initialValues={myInitialValues}>
  {({fields, dirty, valid, submitting, errors, reset, submit}) => {
    return /* some cool ui */;
  }}
</FormState>

For detailed explanations of how to use <FormState /> check out the guide.

validators

The library also makes a number of validation factory functions available out of the box that should help with common use cases, as well as some tools to make building reusable custom validators easy.

import {validate, validators} from '@shopify/react-form-state';

For detailed explanations of the validation utilities, check out the validation docs.

Current Tags

  • 0.11.26                                ...           latest (2 months ago)
  • 1.0.0-sknext-beta.1                                ...           next (a day ago)

84 Versions

  • 1.0.0-sknext-beta.1                                ...           a day ago
  • 0.11.26-sknext-beta.9                                ...           2 days ago
  • 0.0.8-sknext-beta.8                                ...           3 days ago
  • 0.0.2-sknext-beta.2                                ...           8 days ago
  • 0.0.1-sknext-beta.1                                ...           8 days ago
  • 0.11.26                                ...           2 months ago
  • 0.11.25                                ...           2 months ago
  • 0.11.24                                ...           2 months ago
  • 0.11.23                                ...           3 months ago
  • 0.11.22                                ...           3 months ago
  • 0.11.21                                ...           4 months ago
  • 0.11.20                                ...           4 months ago
  • 0.11.19                                ...           5 months ago
  • 0.11.18-core-js-beta.2                                ...           5 months ago
  • 0.11.18-core-js-beta.1                                ...           5 months ago
  • 0.11.18                                ...           6 months ago
  • 0.11.17                                ...           7 months ago
  • 0.11.16                                ...           9 months ago
  • 0.11.15                                ...           9 months ago
  • 0.11.14                                ...           9 months ago
  • 0.11.13                                ...           10 months ago
  • 0.11.12                                ...           10 months ago
  • 0.11.11                                ...           10 months ago
  • 0.11.10                                ...           a year ago
  • 0.11.9                                ...           a year ago
  • 0.11.8                                ...           a year ago
  • 0.11.7                                ...           a year ago
  • 0.11.6                                ...           a year ago
  • 0.11.5                                ...           a year ago
  • 0.11.4                                ...           a year ago
  • 0.11.3                                ...           a year ago
  • 0.11.2                                ...           a year ago
  • 0.11.1                                ...           a year ago
  • 0.11.0                                ...           a year ago
  • 0.10.7                                ...           a year ago
  • 0.10.6                                ...           a year ago
  • 0.10.5                                ...           a year ago
  • 0.10.4                                ...           a year ago
  • 0.10.3                                ...           a year ago
  • 0.10.2                                ...           a year ago
  • 0.10.1                                ...           a year ago
  • 0.10.0                                ...           a year ago
  • 0.9.1                                ...           a year ago
  • 0.9.0                                ...           a year ago
  • 0.8.3                                ...           a year ago
  • 0.8.2                                ...           a year ago
  • 0.8.1                                ...           a year ago
  • 0.8.0                                ...           2 years ago
  • 0.7.4                                ...           2 years ago
  • 0.7.3                                ...           2 years ago
  • 0.7.2                                ...           2 years ago
  • 0.7.1                                ...           2 years ago
  • 0.7.0                                ...           2 years ago
  • 0.6.0                                ...           2 years ago
  • 0.5.6                                ...           2 years ago
  • 0.5.4                                ...           2 years ago
  • 0.5.3                                ...           2 years ago
  • 0.5.2                                ...           2 years ago
  • 0.5.1                                ...           2 years ago
  • 0.5.0                                ...           2 years ago
  • 0.4.3                                ...           2 years ago
  • 0.4.2                                ...           2 years ago
  • 0.4.0                                ...           2 years ago
  • 0.3.4                                ...           2 years ago
  • 0.3.3                                ...           2 years ago
  • 0.3.2                                ...           2 years ago
  • 0.3.1                                ...           2 years ago
  • 0.2.9                                ...           2 years ago
  • 0.2.8                                ...           2 years ago
  • 0.2.7                                ...           2 years ago
  • 0.2.6                                ...           2 years ago
  • 0.2.5                                ...           2 years ago
  • 0.2.4                                ...           2 years ago
  • 0.2.3                                ...           2 years ago
  • 0.2.2                                ...           2 years ago
  • 0.2.1                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.9                                ...           2 years ago
  • 0.1.7                                ...           2 years ago
  • 0.1.6                                ...           2 years ago
  • 0.1.5                                ...           2 years ago
  • 0.1.4                                ...           2 years ago
  • 0.1.3                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
Downloads
Today 0
This Week 38
This Month 54
Last Day 13
Last Week 35
Last Month 19
Dependencies (2)
Dev Dependencies (4)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |