---
title: "Search hooks for React and Next.js"
slug: "search-hooks-for-react-and-next-js"
abstract: "Learn more about the Search hooks available for Content SDK's React and Next.js packages that enable searching with pagination and infinite scrolling."
---
# Search hooks for React and Next.js

Sitecore's `@sitecore-content-sdk/react` and `@sitecore-content-sdk/nextjs` packages provide hooks to execute search queries with pagination and infinite scrolling. The two hooks available are:

- [`useSearch`](https://doc.sitecore.com/sai/en/developers/content-sdk/usesearch.html) - use for pagination with page numbers
- [`useInfiniteSearch`](https://doc.sitecore.com/sai/en/developers/content-sdk/useinfinitesearch.html) - use for infinite scrolling with *load more* functionality

Both hooks support generic types for type-safe results, sorting, custom page sizes, and queries. They're automatically integrated to SitecoreAI via the `SitecoreProvider`.

## Prerequisites

Before using these hooks, ensure that your application is wrapped using the `SitecoreProvider`. This allows the hooks to access required configuration from the `SitecoreProvider` context.

```ts
import { SitecoreProvider } from '@sitecore-content-sdk/nextjs';

function App() {
  return (
    <SitecoreProvider>
      {/* Your app components */}
    </SitecoreProvider>
  );
}
```