Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trs/use-form
Manage form state with React hooks automagically.
https://github.com/trs/use-form
Last synced: 23 days ago
JSON representation
Manage form state with React hooks automagically.
- Host: GitHub
- URL: https://github.com/trs/use-form
- Owner: trs
- Created: 2021-05-22T22:17:43.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-05-22T22:18:08.000Z (over 3 years ago)
- Last Synced: 2024-12-12T00:44:27.932Z (27 days ago)
- Language: TypeScript
- Size: 161 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# `use-form`
Manage form state with React hooks automagically.
## Install
`npm install @trs/use-form`
_or_
`yarn add @trs/use-form`
## Usage
```tsx
import React from 'react';
import ReactDOM from 'react-dom';import {useForm, useSubmit, useChange} from '@trs/use-form`;
const App = () => {
const {control, Form} = useForm({username: '', password: ''});useChange(control, 'username', (value) => {
console.log(`Username changed to: ${username}`);
});useSubmit(control, (state) => {
loginToAPI(state.username, state.password);
});return (
);
};ReactDOM.render(, document.getElementById('app'));
```
## API
### `useForm`
### `useChange`
### `useSubmit`