Overview
The Remix Params Helper is a powerful package designed to streamline the use of Zod with URLSearchParams and FormData in Remix applications. It cleverly reduces boilerplate code and enhances the user experience when validating and parsing data. Despite being a work in progress, with ongoing refinements and updates, this tool already showcases its value by simplifying the handling of untyped data inputs.
The recent updates have introduced significant enhancements, such as improved error handling and support for nested objects and arrays. This ensures you can implement robust validation effortlessly while maintaining a clean codebase.
Features
Effortless Data Validation: Use the
getParams,getSearchParams, andgetFormDatafunctions to easily parse and validate inputs from different sources, returning a clear structure of success or error messages.Customizable Error Messages: Zod allows you to define custom error messages directly in your schema, enhancing the clarity of validation feedback for users.
Support for Nested Objects and Arrays: The API now accommodates nested structures and arrays, allowing for more complex data organization with ease.
OrFail Functions: With the introduction of
getParamsOrFail,getSearchParamsOrFail, andgetFormDataOrFail, you can streamline error handling, automatically throwing errors on validation failures.Improved Input Handling: The
useFormInputPropsfunction dynamically sets input element properties based on your Zod schema, simplifying form management within your applications.Peer Dependency on Zod: This helper package is designed to work seamlessly with Zod, making it easier to integrate into existing setups and leverage powerful validation features.
Multi-value Key Support: The helper accommodates multi-value keys during parsing, converting them into arrays for straightforward management.