React Hook Form & Next.js URL Sync

Becky February 25, 2023
Source
If you're building a search page with Next.js and React Hook Form, you may want to sync the form values with the URL query parameters. This way, users can share the search results with others or bookmark the page. This hook will sync any form value changes with the URL query parameters and allow you to use the URL query parameters as your source of truth for fetching data. It will also sync any changes to the URL query parameters with the form values. For example, the back and forward browser buttons will work as expected. Dependencies React React Hook Form Next.js lodash/isEqual - or any other deep equality check function qs The Hook

Discussion in the ATmosphere

Loading comments...