Installation
Install the @guanriyue/decurl package in a React Router application. It supports React 18, React 19, and requires React Router 7.
Install
Install it with the package manager used by your project:
You can also use npm or yarn:
Basic Usage
The basic Decurl flow is:
- Define Search Fields.
- Read and update URL search state through React Router hooks.
This example writes the input value to the q param in the URL. When the URL changes, the hook decodes the corresponding business value again.
No Extra Provider Required
The default useSearchValue and useSearchValues hooks can be used directly in a React Router environment. Most applications do not need to manually create a Provider or store.
If you need to isolate multiple search state instances, configure store behavior, or reduce direct dependency on React Router useLocation, continue with Provided Runtime.