2.1.0 • Published 11 months ago

@iamcosta/url-params-hook v2.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

url-params-hook

What about map an object to url search parameters? :)

Installation

npm install @iamcosta/url-params-hook
# or
yarn add @iamcosta/url-params-hook

Usage

import { useUrlParams } from  "@iamcosta/url-params-hook";

// ...
type YourType = {
    someProp: string;
    anotherProp: number;
}
const { values, onChange } = useUrlParams<YourType>({
  ignoreKeys: ["keys", "of", "YourType", "to", "be", "ignored"]
});
// ignoreKeys is optional...

// ...

// This change url parameters...
onChange({
    someProp: "some text",
    // ...
});

// ... while this obtains the new value provided by url state in any place
const { someProp } = values;

License

MIT @ Iam Barroso da Costa

2.1.0

11 months ago

2.0.85

11 months ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago