@sailnjord/use-search-state
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

use-search-state

Usage

useSearchState(
  // Send any state to the search/query string
  // Changing this value will cause a pushState()
  {
    foo: 123,
    bar: 42,
  },
  // Handle changes in the search/query string
  // (called once for the initial page load, and for
  // subsequent changes including on forward/back
  // navigation by the user)
  ({ foo, bar }) => {
    // For example, copy to local state:
    // setFoo(foo)
    // setBar(bar)
  }
);

Readme

Keywords

none

Package Sidebar

Install

npm i @sailnjord/use-search-state

Weekly Downloads

16

Version

0.0.3

License

MIT

Unpacked Size

9.24 kB

Total Files

5

Last publish

Collaborators

  • jonaswitt