Skip to content

Latest commit

 

History

History
102 lines (75 loc) · 4.42 KB

README.ja-JP.md

File metadata and controls

102 lines (75 loc) · 4.42 KB

高性能で柔軟かつ拡張可能な使いやすいフォームバリデーションライブラリ。

CircleCI npm downloads npm dep npm Coverage Status

Tweet Join the community on Spectrum

🇦🇺English | 🇨🇳简体中文 | 🇯🇵Japanese

特徴

  • パフォーマンスと DX を念頭に構築
  • 非制御フォームバリデーション
  • 依存関係のない小さなサイズ
  • React Native との互換性
  • Yup スキーマベースのバリデーションをサポート
  • ブラウザのネイティブバリデーションをサポート
  • Form Builder でフォームを素早く作成

インストール

$ npm install react-hook-form

リンク集

クイックスタート

import React from 'react';
import useForm from 'react-hook-form';

function App() {
  const { register, handleSubmit, errors } = useForm(); // initialise the hook
  const onSubmit = data => {
    console.log(data);
  };

  return (
    <form onSubmit={handleSubmit(onSubmit)}>
      <input name="firstname" ref={register} /> {/* register an input */}

      <input name="lastname" ref={register({ required: true })} />
      {errors.lastname && 'Last name is required.'}

      <input name="age" ref={register({ pattern: /\d+/ })} />
      {errors.age && 'Please enter number for age.'}

      <input type="submit" />
    </form>
  );
}

コントリビューター

これらの素晴らしい人々に感謝します。[コントリビューターになる]

支援者

全ての支援者に感謝します! [支援者になる]