---
title: React Turnstile - Interact with the widget
---

# Interact with the widget

You can interact with the widget using the `ref` prop. The available methods are listed [here](/use-ref-methods).

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

export default function Widget() {
  const ref = React.useRef<TurnstileInstance | null>(null);

  return (
    <>
      <Turnstile ref={ref} siteKey="{{ siteKey }}" />

      <button onClick={() => alert(ref.current?.getResponse())}>
        Get response
      </button>

      <button onClick={() => ref.current?.reset()}>
        Reset widget
      </button>

      <button onClick={() => ref.current?.remove()}>
        Remove widget
      </button>

      <button onClick={() => ref.current?.render()}>
        Render widget
      </button>
    </>
  );
}
```
