> For the complete documentation index, see [llms.txt](https://pollz.gitbook.io/pollz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pollz.gitbook.io/pollz/tooling/react/useanonymouspoll.md).

# useAnonymousPoll()

## `useAnonymousPoll`&#x20;

The `useAnonymousPoll` hook is a custom hook provided by the `pollz-react` package. It allows you to fetch an anonymous poll using the provided poll token from the Pollz SDK within a React component.

### Parameters

#### `pollToken` (string)

* The poll token for the anonymous poll you want to fetch.

### Return Values

The `useAnonymousPoll` hook returns an object with the following properties:

* `poll` (PollWithOptions | null): The fetched anonymous poll object. `null` if the poll is still loading.
* `refetch` (function): A function to manually refetch the anonymous poll data.

### Usage

```jsx
import { useAnonymousPoll } from 'pollz-react';

const YourComponent = ({ pollToken }) => {
  const { poll, refetch } = useAnonymousPoll(pollToken);

  if (!poll) {
    return <div>Loading...</div>;
  }

  return (
    <div>
      <h2>Anonymous Poll</h2>
      <p>{poll.name}</p>
      {/* Render additional anonymous poll details */}
      <button onClick={() => refetch()}>Refetch Anonymous Poll</button>
    </div>
  );
};
```
