How to use the rc-form-hooks function in rc-form-hooks

To help you get started, we’ve selected a few rc-form-hooks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mushan0x0 / rc-form-hooks / example / src / App.tsx View on Github external
function RegistrationForm() {
  const [state, setState] = useState({
    confirmDirty: false,
    autoCompleteResult: []
  });

  const form = useForm();

  const handleSubmit = (e: React.FormEvent) => {
    e.preventDefault();
    form
      .validateFields(['transfer'])
      .then(() => console.log('Received values of form: ', form.values));
  };

  const handleConfirmBlur = (e: any) => {
    const { value } = e.target;
    setState({ ...state, confirmDirty: state.confirmDirty || !!value });
  };

  const compareToFirstPassword = (rule: any, value: any, callback: any) => {
    if (value && value !== form.getFieldValue('password')) {
      callback('Two passwords that you enter is inconsistent!');

rc-form-hooks

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

MIT
Latest version published 3 years ago

Package Health Score

39 / 100
Full package analysis

Popular rc-form-hooks functions

Similar packages