UNPKG

@matthew.ngo/react-filter-pilot

Version:

Powerful filtering, pagination, and sorting for React with TanStack Query integration

3 lines 713 B
import {a}from'../chunk-KDVV4H2M.js';import {useState,useEffect}from'react';/* @matthew.ngo/react-filter-pilot - MIT License */ function l(){const[t,r]=useState(()=>new URLSearchParams(window.location.search));return useEffect(()=>{const e=a(()=>{r(new URLSearchParams(window.location.search));},"handlePopState");return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[]),{getParams:a(()=>t,"getParams"),setParams:a(e=>{const n=`${window.location.pathname}?${e.toString()}`;window.history.pushState(null,"",n),r(e);},"setParams")}}a(l,"useDefaultUrlHandler");export{l as useDefaultUrlHandler};//# sourceMappingURL=useUrlHandler.js.map //# sourceMappingURL=useUrlHandler.js.map