This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

react-router-use-url-query-state
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

React Router - Use URL Query State

React hook that leverages the React Router to create a state that's synchronized with the query parameters in the browser url.

Usage

Use just like a React's useState hook:

// for a string value
const [myStateValue, setMyStateValue] = useURLQueryState(
  "parameterName",
  "initialValue"
);

// for a string list value
const [myStateValue, setMyStateValue] = useURLQueryState("parameterName", [
  "initial",
  "values",
]);

Value stored in the URL Query State must be either a string or a list of strings. It can be only one of these types, cannot be both.

Package Sidebar

Install

npm i react-router-use-url-query-state

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

6.03 kB

Total Files

9

Last publish

Collaborators

  • ncpa0cpl