useForm: Lightweight React Form Utility Library

Installation:

# Yarn
$ yarn add @rvision/use-form

# NPM
$ npm i @rvision/use-form

Basic usage:

const defaultValues = {
  firstName: '',
  lastName: '',
  email: '',
  agree: false
};
const Form = () => {
  const {
    register,
    handleSubmit,
  } = useForm({
    defaultValues
  });
  const onSubmit = values => console.log(values);
  return (
    <div>
        <label>
          Enter first name:
          <input type="text" {...register('firstName')} />
        </label>
        <label>
          Enter last name:
          <input type="text" {...register('lastName')} />
        </label>
        <label>
          Enter email:
          <input type="email" {...register('email')} />
        </label>
        <label>
          <input type="checkbox" {...register('agree')} />
          I agree to terms and conditions
        </label>
        <button type="submit" onClick={handleSubmit(onSubmit)}>
          Register
        </button>
    </div>
  );
}

Preview:

Lightweight React Form Utility Library - useForm

Download Details:

Author: rvision

Live Demo: View The Demo

Download Link: Download The Source Code

Official Website: https://github.com/rvision/useForm

License: MIT

#react #reactjs 

useForm: Lightweight React Form Utility Library
1.05 GEEK