Skip to content
wsimmonds avatar

Nextjs Use Search Params Suspense

Pattern for reading URL query parameters with useSearchParams, requiring 'use client' and a Suspense boundary in Next.js.

CCM score
42 of 100
skills.sh installs
316
GitHub stars
116
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers the two-part requirement: a 'use client' directive and a <Suspense> wrapper around any component calling useSearchParams
  • Includes single-file and split-file examples, plus search, product filter, and pagination implementations
  • Shows reading helpers (get, getAll, has, forEach) and updating params via router.push with URLSearchParams
  • Designed for client components that build search interfaces, filters, or pagination driven by URL query state

Install

$ npx -y skills add wsimmonds/claude-nextjs-skills --skill nextjs-use-search-params-suspense -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Next.js: useSearchParams with Suspense Pattern

Pattern Overview

The useSearchParams hook requires TWO things:

  1. Component must have 'use client' directive
  2. Component must be wrapped in a <Suspense> boundary

This is a Next.js requirement, not optional!

Why This Pattern?

useSearchParams reads URL query parameters:

  • /search?q=shoes → searchParams.get('q') returns "shoes"
  • /products?category=electronics&sort=price → Read multiple params

Why Suspense? Next.js uses React 18's Suspense to handle the async nature of reading URL params during server-side rendering and hydration.

The Pattern

Single-File Pattern (Recommended)

// app/page.tsx
import { Suspense } from 'react';
import SearchComponent from './SearchComponent';

export default function Page() {
  return (
    <Suspense fallback={<div>Loading...</div>}>
      <SearchComponent />
    </Suspense>
  );
}

// app/SearchComponent.tsx
'use client';

import { useSearchParams } from 'next/navigation';

export default function SearchComponent() {
  const searchParams = useSearchParams();
  const query = searchParams.get('q') || '';

Details

Repository
github.com/wsimmonds/claude-nextjs-skills
Categories
Frontend & UI Code, Backend & APIs
First seen
Jun 3, 2026

Questions

What does the nextjs-use-search-params-suspense skill do?

nextjs-use-search-params-suspense teaches the pattern for reading URL query parameters with the useSearchParams hook in Next.js. It requires a client component marked with the 'use client' directive, wrapped in a Suspense boundary. The skill covers search interfaces, filters and pagination.

How do I install the nextjs-use-search-params-suspense skill?

Run npx -y skills add wsimmonds/claude-nextjs-skills --skill nextjs-use-search-params-suspense -y in a project to install it. Once installed, nextjs-use-search-params-suspense guides the agent to set up useSearchParams with a Suspense wrapper correctly.

Which category does nextjs-use-search-params-suspense belong to?

nextjs-use-search-params-suspense sits in the Frontend and UI Code category on Claude Marketplaces. It is aimed at building search interfaces, filters and pagination in Next.js client components that read or update URL query parameters.

When should I use nextjs-use-search-params-suspense?

Use nextjs-use-search-params-suspense when building search interfaces, filters, pagination or any Next.js feature that reads or manipulates URL query parameters client-side. It shows how to read single and multiple parameters and how to update them with the router.

More from wsimmonds/claude-nextjs-skills

All 9

Similar to Nextjs Use Search Params Suspense

More Frontend & UI Code