New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-formation

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-formation

[![Build Status](https://travis-ci.org/k88hudson/react-formation.svg)](https://travis-ci.org/k88hudson/react-formation) [![Coverage Status](https://coveralls.io/repos/k88hudson/react-formation/badge.svg?branch=master&service=github)](https://coveralls.io/

npmnpm
Version
0.0.1
Version published
Weekly downloads
7
-53.33%
Maintainers
1
Weekly downloads
 
Created
Source

React Formation

Build Status Coverage Status

Important note

At current time of writing, this is a component API experiment -- the validation support etc. is still in progress.

Try it out

Clone the example repo from https://github.com/k88hudson/react-formation-example to try this out.

What it does

Using this form library, you can

  • Create forms with a schema, including validations
  • Link inputs in child components back to the form
  • Handle submitting and showing errors with helper components
  • Get the "valid" or "submit attempt" state of the entire form at any time

Rationale

Maintain a single source of truth in any component structure

Handling any kind of nested display and control of user input can be tricky in React. In order to prevent synchronization errors, we want to maintain a single source of truth for our form's data instead of fragmenting it down the component tree; however, this can become overly complex, verbose, and/or fragile if the components get too nested or the data model of the data set is very large.

Inspired by react-router, react-formations uses a top-level schema in combination with React's context feature to maintain a consistent api at all levels of the component tree.

Integrate existing input components and conventions

Any form system that requires the use of generated inputs or specific input component structures quickly becomes too rigid except for the simplest of forms.

react-formations allows you to use any input or component you like, in any html structure you like. Links back to the single source of truth are managed via React's two-way-binding utility, which can be added directly to native inputs or controlled manually in an onChange handler.

Simplify display of errors

No matter how you chose to validate your data, displaying error messages almost always requires a lot of complex logic from multiple sources: did the user attempt to submit? Are there any errors? Is the field required?

react-formations attemps to simplify this by providing a means of tracking submit status and validity/errors for each field at the top level component, and exposing this information to all child components via the context API.

It also includes an component with good default behaviour in both single and multi form contexts.

Guide and examples

Check out the guide and examples.

FAQs

Package last updated on 31 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts