47ng/nuqs ? reverse-engineered prompt
Reverse engineered prompt
I want to build a type-safe state management library for React that syncs state with the URL's search parameters. The main idea is to have a hook that works just like useState, but it stores its value in the URL query string. For example, const [name, setName] = useQueryState('name') would sync the name variable with the ?name=... parameter in the URL.
This should make it really easy to create shareable and bookmarkable page states. It needs to be more powerful than just handling strings, so please include built-in parsers for common types like integers, floats, booleans, and dates. I'd also like the ability to handle arrays or even JSON objects. The library should be flexible enough to work with the latest versions of Next.js (both app and pages routers), Remix, and React Router. The goal is a simple, intuitive API that makes URL state management feel native to React.
Are you gonna build this?
make sure you review the code using coderabbit