All Forms posts

  • Testing React Hook Form With React Testing Library

    Testing React Hook Form With React Testing Library

    Updated on · 8 min read

    React Hook Form has emerged as a popular and efficient library for managing form state and validation in React applications. It simplifies handling form inputs, reduces boilerplate code, and provides a performant solution for form management. However, testing these forms efficiently and accurately is just as important as implementing them.


  • Managing Forms with React Hook Form

    Managing Forms with React Hook Form

    Updated on · 9 min read

    Working with forms in React is notoriously difficult, particularly when there are dynamic fields involved. There exist several libraries that make the whole process easier. One such library is React Hook Form. In this post, we talk about the basics of React Hook Form and learn how to use it to simplify form management in your React applications.


  • Creating Accessible Form Components with React

    Creating Accessible Form Components with React

    Updated on · 9 min read

    Learn how to create accessible form components with React to ensure that all users, including those with disabilities, can interact with your web applications.


  • Simplifying Form Rendering In React with Field Component Abstraction

    Simplifying Form Rendering In React with Field Component Abstraction

    Updated on · 5 min read

    Learn how to simplify form rendering in React by abstracting the field rendering logic into a reusable component.


  • Build a Multistep Form With React Hook Form

    Build a Multistep Form With React Hook Form

    Updated on · 8 min read

    Multistep forms a.k.a. wizard or funnel forms have a wide range of uses. They are most common when collecting different types of information into one data structure but are also useful to break down very large forms into the less user-intimidating multistep process. In this post, we'll build a basic multistep registration form, which collects the user's info and then presents it in a confirmation view, which can be reviewed and edited before the submission.


  • React Hook Form: Working with Multipart Form Data and File Uploads

    React Hook Form: Working with Multipart Form Data and File Uploads

    Updated on · 7 min read

    Learn how to handle file uploads and multipart form data in React applications using React Hook Form. This tutorial demonstrates adding file input fields, working with FormData API, and submitting form data.


  • Build Dynamic Forms with React Hook Form

    Build Dynamic Forms with React Hook Form

    Updated on · 5 min read

    Discover how to efficiently create scalable and maintainable dynamic forms for various configurations using React Hook Form. This guide explores practical strategies and code examples for rendering flexible form controls with streamlined validation in React applications.


  • Form Validation with React Hook Form

    Form Validation with React Hook Form

    Updated on · 7 min read

    Form validation is the process of checking the entered data against specific criteria before it is processed. This can include checking that a required field has been filled out, that an email address is in the correct format, or that a password meets specific complexity requirements. Among the numerous tools and libraries available for form validation in React, React Hook Form stands out as a robust, easy-to-use solution.


  • Display Warning for Unsaved Form Data on Page Exit

    Display Warning for Unsaved Form Data on Page Exit

    Updated on · 6 min read

    This article shows how to implement a FormPrompt component that alerts users when they attempt to leave a page with unsaved changes. It discusses handling such scenarios using pure JavaScript with the beforeunload event, as well as React-specific solutions using the Prompt component in React Router v5 and the useBeforeUnload and unstable_useBlocker hooks in React Router v6.


  • Advanced Multistep Forms with React Hook Form

    Advanced Multistep Forms with React Hook Form

    Updated on · 7 min read

    In a previous post, we built a basic multistep registration form using React and React Hook Form. In this article, we'll expand upon that foundation by implementing improvements, such as enabling data saving during step navigation and enhancing the visual representation of each step's state.


  • TypeScript: Typing Form Events In React

    TypeScript: Typing Form Events In React

    Updated on · 9 min read

    Handling events in React is very close to how the events on DOM elements are handled. The biggest difference is, however, that React wraps the native DOM events into SyntheticEvent, making them behave slightly differently than the native events. Consequently, typing form events in React is not the same as native events. In this post, we'll see how to type form events in React on the example of a simple component as well as discuss the most common pitfalls.


Back to all posts