Skip to content

Use hooks to bind form components to actions such as uniform validation and get values.

License

Notifications You must be signed in to change notification settings

simpleler/rc-form-hooks

 
 

Repository files navigation

rc-form-hooks

Use hooks to bind form components to actions such as uniform validation and get values.

NPM JavaScript Style Guide

Install

npm install --save rc-form-hooks

Usage

import React from 'react'
import useForm from 'rc-form-hooks'

export default () => {
  const { getFieldDecorator, validateFields } = useForm<{ username: string }>();
  const handleSubmit = (e: React.FormEvent) => {
    e.preventDefault();
    validateFields()
      .then(console.log);
  };
  return (
    <form onSubmit={handleSubmit}>
      {getFieldDecorator('username')(
        <input type="text"/>
      )}
      <button type={'submit'}>submit</button>
    </form>
  )
}

License

MIT © mushan0x0

About

Use hooks to bind form components to actions such as uniform validation and get values.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 94.2%
  • JavaScript 4.0%
  • HTML 1.5%
  • CSS 0.3%