<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: AMAL</title>
    <description>The latest articles on DEV Community by AMAL (@amalmktk).</description>
    <link>https://dev.to/amalmktk</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4113594%2F7ea46e00-e819-4aac-a56e-6cd148c33752.webp</url>
      <title>DEV Community: AMAL</title>
      <link>https://dev.to/amalmktk</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/amalmktk"/>
    <language>en</language>
    <item>
      <title>react-query-filters: A Headless React Hook for URL-Synced Search, Filters, Sorting &amp; Pagination</title>
      <dc:creator>AMAL</dc:creator>
      <pubDate>Mon, 07 Sep 2026 09:41:24 +0000</pubDate>
      <link>https://dev.to/amalmktk/react-query-filters-a-headless-react-hook-for-url-synced-search-filters-sorting-pagination-4ea1</link>
      <guid>https://dev.to/amalmktk/react-query-filters-a-headless-react-hook-for-url-synced-search-filters-sorting-pagination-4ea1</guid>
      <description>&lt;p&gt;Every React project I've worked on eventually needs the same thing: search, filters, sorting, and pagination that survive a page refresh and can be shared through a URL.&lt;/p&gt;

&lt;p&gt;I've found myself repeatedly writing useSearchParams and URLSearchParams boilerplate to handle this.&lt;/p&gt;

&lt;p&gt;So I built react-query-filters — a small, headless hook for managing query state and keeping it synchronized with the URL.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;setSearch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;setFilter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;setSort&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;setPage&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useQueryFilters&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your URL automatically stays in sync:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/products
    ↓
/products?search=laptop&amp;amp;status=active&amp;amp;sort=price:desc&amp;amp;page=2

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No manual URLSearchParams juggling, and browser back/forward navigation works naturally.&lt;/p&gt;

&lt;p&gt;Why I built it&lt;br&gt;
🎯 Headless — no UI components or design system imposed&lt;br&gt;
🔗 URL-synced — state survives refresh and is easily shareable&lt;br&gt;
⚛️ React-friendly — simple hooks-based API&lt;br&gt;
🧩 Framework-agnostic core — usable with frameworks such as Next.js&lt;br&gt;
📅 Date &amp;amp; range filters&lt;br&gt;
📦 Zero runtime dependencies&lt;br&gt;
🔄 Browser history support&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The goal&lt;/strong&gt;&lt;br&gt;
The goal isn't to build another UI filtering library.&lt;/p&gt;

&lt;p&gt;It's to provide a small layer for URL query-state management while leaving the UI completely up to you.&lt;/p&gt;

&lt;p&gt;You can use it with your existing components, whether that's your own design system, shadcn/ui, MUI, or something else.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Early project&lt;/strong&gt;&lt;br&gt;
This is still an early project — currently v1.1.0.&lt;/p&gt;

&lt;p&gt;I'd especially love feedback on the API design.&lt;/p&gt;

&lt;p&gt;Is the API intuitive?&lt;/p&gt;

&lt;p&gt;Are there patterns you would handle differently?&lt;/p&gt;

&lt;p&gt;Are there edge cases around URL state that you think the library should support?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;br&gt;
GitHub:&lt;br&gt;
&lt;a href="https://github.com/Amalmktk/react-query-filters" rel="noopener noreferrer"&gt;https://github.com/Amalmktk/react-query-filters&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;npm:&lt;br&gt;
&lt;a href="https://www.npmjs.com/package/react-query-filters" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/react-query-filters&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Install it with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;react-query-filters

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thanks for checking it out! 🚀&lt;/p&gt;

</description>
      <category>react</category>
      <category>typescript</category>
      <category>webdev</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
