@matthew.ngo/react-filter-pilot
Version:
Powerful filtering, pagination, and sorting for React with TanStack Query integration
3 lines • 769 B
JavaScript
;var react=require('react');/* @matthew.ngo/react-filter-pilot - MIT License */
var o=Object.defineProperty;var a=(t,r)=>o(t,"name",{value:r,configurable:true});function d(){const[t,r]=react.useState(()=>new URLSearchParams(window.location.search));return react.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(d,"useDefaultUrlHandler");exports.useDefaultUrlHandler=d;//# sourceMappingURL=useUrlHandler.cjs.map
//# sourceMappingURL=useUrlHandler.cjs.map