@sutiles/react-form-handler
v1.0.1
Published
React hook and component to handle forms
Downloads
2
Maintainers
Readme
React Forumu
Simple and powerful form handler for React (TypeScript support)
Important
At the moment, this library can only be used as a react hook.
Sections
Installation
Install as package with npm:
npm install @sutiles/react-form-handler
Setup
Example
import React from 'react';
import { useForumu } from '@sutiles/react-form-handler';
export default function Login() {
const { values, submitHandler } = useFormHandler({
initValues: {
email: '',
password: '',
},
});
const onSubmit = submitHandler(({ email, password }) => {
signIn(email, password);
});
return (
<form onSubmit={onSubmit}>
<input {...setInput('email')} />
<input {...setInput('password', { type: 'password' })} />
<button type='submit'>Login</button>
</form>
);
}
Settings
soon more information