Strongly-typed React form state management
formula-one is a library which makes it easier to write type-safe forms with validations and complex inputs.

Edit the working example on CodeSandbox
``jsx
// @flow strict
import React from "react";
import {Form, Field, ObjectField, FeedbackStrategies} from "formula-one";
type Person = {
name: string,
age: string,
faction: "Empire" | "Rebels",
};
const EMPTY_PERSON: Person = {
name: "",
age: "",
faction: "Empire",
};
export default function SimpleExample() {
return (
Philosophy
formula-one helps you write forms in React by managing the state of your form and ensuring your inputs are the right type. It does this by introducing a new abstraction, called a _Field_. A _Field_ wraps some value and provides a way to render and edit that value. A simple _Field_ might wrap a
string, which displays and edits its value through an . A more complex value, such as a date and time might be displayed as an ISO 8601 string and be edited through a calendar input.Fields are specified using the
component, which wraps your input using a render prop. It provides the value, errors, onChange, and onBlur handlers, which should be hooked up to your input.Individual Fields are aggregated into objects and arrays using the
and components. These components enable you to build forms with multiple fields.In formula-one, all of the form's state is held in the