Skip to content

I made a register page using React Hook Form with zod. Iplemented schema, useForm

Notifications You must be signed in to change notification settings

HamzaDogann/React-TypeScript-Form-Validations

Repository files navigation

Form Validations with React Hook Form and Zod

This documentation will guide you on how to implement form validations using React Hook Form library integrated with Zod schema validation.

What is React Hook Form?

React Hook Form is a library optimized for managing forms in React with a focus on performance and developer experience by leveraging React hooks.

Advantages

  • Performance: Enhances performance by only tracking input changes.
  • Easy Integration: Easily integrates into React projects due to its hook-based architecture.
  • Support for Yup, Zod: Supports integration with schema validation libraries like Yup, Zod for validation rules.

What is Zod?

Zod is a TypeScript-compatible schema validation library used to define and validate object and data structures, enhancing type safety and developer productivity.

Installation

To install React Hook Form & Zod, follow these steps:

  1. Install React Hook Form in your project:

    npm install react-hook-form
  2. Install Zod in your project:

    npm install zod
    

You can examine the source codes of an example of a registration page using schema (Patterns, validations) that I made with React hook from and Zod.

image

image

image

image

image

For other validation processes that I cannot show, check out the source code and try everything yourself.

About

I made a register page using React Hook Form with zod. Iplemented schema, useForm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published