Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pedropfuenmayor/cool-react-hook-form

Fork of react-hook-form
https://github.com/pedropfuenmayor/cool-react-hook-form

Last synced: 3 days ago
JSON representation

Fork of react-hook-form

Awesome Lists containing this project

README

        

# Cool React Hook Form

This fork of [react-hook-form](https://github.com/react-hook-form/react-hook-form) introduces a specific enhancement for handling form inputs: whenever an input field is an empty string, it automatically transforms this value to undefined. This can be particularly useful for simplifying integrations with backend systems that distinguish between empty strings and undefined values, or when applying validations that treat these differently.

### Features

- Automatic Transformation: Automatically convert empty string inputs to undefined, simplifying certain validation and state management scenarios.
- Seamless Integration: Designed to be a drop-in replacement with minimal changes needed for existing React Hook Form implementations.

### Install

npm install cool-react-hook-form

### Quickstart

```jsx
import { useForm } from 'cool-react-hook-form';

function App() {
const {
register,
handleSubmit,
formState: { errors },
} = useForm();

return (
console.log(data))}>


{errors.lastName &&

Last name is required.

}

{errors.age &&

Please enter number for age.

}


);
}
```

### Acknowledgments

- Thanks to the original authors and contributors of React Hook Form for providing a solid foundation for this fork.