1.0.2 • Published 1 year ago

preformer v1.0.2

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Preformer

Preformer is a library for pre-forming application's form; validate form's submitions

npm install preformer

Example

An example of contact form in typescript react

import { yup, usePreformer } from "preformer";

const schema = yup.object({
  email: yup.string().email(),
  message: yup.string().min(4),
});

function Contact() {
  const [ref, { exception }] = usePreformer(schema, (e, data) => {
    console.log("Contact submission successed.", data);
  });

  return (
    <form ref={ref}>
      {!!exception && <span>{exception.message}</span>}
      <input type="text" name="email" />
      <input type="text" name="message" />
      <input type="submit" value="submit" />
    </form>
  );
}
1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago