How to use the @hookform/resolvers.yupResolver function in @hookform/resolvers

To help you get started, we’ve selected a few @hookform/resolvers 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 TheOdinProject / theodinproject / app / javascript / components / project-submissions / components / edit-form.jsx View on Github external
const EditForm = ({
  submission, onSubmit, onClose, onDelete,
}) => {
  const {
    register, errors, handleSubmit, formState,
  } = useForm({
    resolver: yupResolver(schema),
    defaultValues: {
      repo_url: submission.repo_url,
      live_preview_url: submission.live_preview_url,
      is_public: submission.is_public,
    },
  });

  const handleDelete = () => {
    onDelete(submission.id);
    onClose();
  };

  if (formState.isSubmitSuccessful) {
    return (
      <div>
        <h1>Thanks for Updating Your Solution!</h1></div>
github TheOdinProject / theodinproject / app / javascript / components / project-submissions / components / create-form.jsx View on Github external
const CreateForm = ({ onClose, onSubmit, userId }) =&gt; {
  const { lesson } = useContext(ProjectSubmissionContext);
  const {
    register, handleSubmit, formState, errors,
  } = useForm({
    resolver: yupResolver(schema),
    defaultValues: {
      is_public: true,
    },
  });

  if (userId === null) {
    return (
      <div>
        <h1>Please Sign in</h1>
        <p data-test-id="sign-in-instructions">
          Please
          {' '}
          <a href="/login">sign in</a>
          {' '}
          to add a project submission.
        </p></div>

@hookform/resolvers

React Hook Form validation resolvers: Yup, Joi, Superstruct, Zod, Vest, Class Validator, io-ts, Nope, computed-types, TypeBox, arktype, Typanion, Effect-TS and VineJS

MIT
Latest version published 2 months ago

Package Health Score

95 / 100
Full package analysis