React hooks for the @corets/form package.
Last updated 2 years ago
Source code is hosted on GitHub
yarn add @corets/use-form
npm install --save @corets/use-form
This is a React integration for this package:
Use forms inside React components:
import React from "react" import { createForm } from "@corets/form" import { useForm } from "@corets/use-form" const Example = () => { const form = useForm(() => createForm({ text: "foo" })) return ( <> <input value={form.get("text")} onChange={(e) => form.set("text", e.target.value)} /> // with the static field <input value={form.getFields().text.get().getValue()} onChange={(e) => form.getFields().text.get().setValue(e.target.value)} /> </> ) }