> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Loading indicator

> Learn how to display a loading indicator with React InstantSearch.

<Note>
  This is the **React InstantSearch v7** documentation.
  If you're upgrading from v6, see the [upgrade guide](/doc/guides/building-search-ui/upgrade-guides/react/#migrate-from-react-instantsearch-v6-to-react-instantsearch-v7).
  If you were using React InstantSearch Hooks,
  this v7 documentation applies—just check for [necessary changes](/doc/guides/building-search-ui/upgrade-guides/react/#migrate-from-react-instantsearch-hooks-to-react-instantsearch-v7).
  To continue using v6, you can find the [archived documentation](https://algolia.com/old-docs/deprecated/instantsearch/react/v6/api-reference/instantsearch/).
</Note>

You can display a loading indicator to inform users on a slow connection that their search is still in progress.

Use InstantSearch's `status` indicator to decide when to show a loading indicator. The `status` can be one of the following:

* `loading`: The search is in progress.
* `stalled`: The search is in progress, but the response is taking longer than expected.
* `error`: The search failed.
* `idle`: The search succeeded.

Best practice is to display a loading indicator only when `status` is `stalled`, not during a standard (fast) search.
Tweak the timing of the `stalled` status by setting the [`stalledSearchDelay`](/doc/api-reference/widgets/instantsearch/react) option.

You can then use this condition to display a loading indicator:

```jsx React icon=code theme={"system"}
function LoadingIndicator() {
  const { status } = useInstantSearch();

  if (status === "stalled") {
    return <p>Loading search results</p>;
  }
  return null;
}
```

If you want the loading indicator to display as soon as the search starts, use the `loading` status in combination with `stalled`:

```jsx React icon=code theme={"system"}
function LoadingIndicator() {
  const { status } = useInstantSearch();

  if (status === "loading" || status === "stalled") {
    return <p>Loading search results</p>;
  }
  return null;
}
```
