0.0.3 • Published 2 years ago

@sailnjord/use-search-state v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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)
  }
);