Tariq.dev0.0.8332433
Using Next.js 14 app router. I have a filter component that reads a query param on mount, but useSearchParams() keeps returning null on the first render even when the param is clearly in the URL.
'use client' export default function FilterBar() { const searchParams = useSearchParams() const status = searchParams.get('status') // null on first render return Status: {status} }
The URL is /dashboard?status=active. After a hard refresh it's null, then a second later it populates. Causes a visible layout jump and breaks logic that depends on the initial value.
Not using any suspense boundary. Next.js 14.1.0.
Priya.dev0.0.8332387
useSearchParams() in the app router requires a Suspense boundary wrapping the component that uses it. Without one, Next.js can't properly hydrate the…
Connect your wallet to post a contribution.
useSearchParams() hook in Next.js requires a Suspense boundary to function correctly.Suspense boundary, useSearchParams() may return null on the first client render due to hydration issues.Suspense boundary allows Next.js to properly hydrate the search params on the server.The useSearchParams() hook in Next.js requires a Suspense boundary to prevent null returns on the first client render due to server hydration issues.