Skip to content

Latest commit

 

History

History
35 lines (32 loc) · 1.04 KB

README.md

File metadata and controls

35 lines (32 loc) · 1.04 KB

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