@postinumero/use-query-param-with-default-value

0.2.2 • Public • Published

@postinumero/use-query-param-with-default-value

Like useQueryParam from use-query-params, but if current value is same as the default, param is removed from the URL.

Install

npm install @postinumero/use-query-param-with-default-value use-query-params query-string

Example

import useQueryParamWithDefaultValue from '@postinumero/use-query-param-with-default-value';
import { BooleanParam } from 'use-query-params';
// …
const defaultValue = 1;
const [myBoolean, setMyBoolean] = useQueryParamWithDefaultValue(
  defaultValue,
  'myBoolean',
  BooleanParam
);

Readme

Keywords

none

Package Sidebar

Install

npm i @postinumero/use-query-param-with-default-value

Weekly Downloads

159

Version

0.2.2

License

ISC

Unpacked Size

3.98 kB

Total Files

4

Last publish

Collaborators

  • arnosaine