1.1.5 • Published 7 months ago

@kavre/react-useform v1.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

React Form Hook

example

import React from 'react';
import * as yup from 'yup';
import useForm from '@kavre/react-useform';

const App = () => {
  const {
    values,
    errors,
    handleChange,
    handleSubmit,
    resetValues,
    submit,
    setValues,
  } = useForm({
    initialValues: {
      name: '',
    },
    validationSchema: yup.object({
      name: yup.string().required(),
    }),
    onSubmit: async (values) => {
      console.log(values);
      resetValues();
    },
  });
  return (
    <form onSubmit={handleSubmit}>
      <input onChange={handleChange('name')} value={values.name} />
      <button type="submit">Submit</button>

      {errors.name && <p>{errors.name}</p>}
    </form>
  );
};

export default App;
1.1.1

7 months ago

1.1.5

7 months ago

1.1.4

7 months ago

1.1.3

7 months ago

1.1.2

7 months ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.2

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago