---
title: React Turnstile - Managing widget status
---
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.page/marsidev/react-turnstile/llms.txt
> Use this file to discover all available pages before exploring further.

# Managing widget status

You can use the callbacks `onError`, `onExpire` and `onSuccess` to manage the widget status.

```tsx
import { Turnstile } from "@marsidev/react-turnstile";

type Status = "error" | "expired" | "solved";

export default function Widget() {
  const [status, setStatus] = React.useState<Status | null>(null);

  return (
    <Turnstile
      siteKey="{{ siteKey }}"
      onError={() => setStatus("error")}
      onExpire={() => setStatus("expired")}
      onSuccess={() => setStatus("solved")}
    />
  );
}
```
