React
The package pollz-react
has been develop to integrate the Node.js SDK easily within a React app.
The PollzProvider
component wraps your React application, providing access to the Pollz SDK functionalities through React context. It initializes the SDK with the specified appId
and appSecret
and makes the SDK instance available to all child components.
useAnonymousPoll
useAnonymousPoll
Fetches an anonymous poll using the provided
pollToken
.Returns the poll object and a function to refetch the poll.
usePollTypes
usePollTypes
Fetches all available poll types.
Returns the list of poll types.
usePoll
usePoll
Fetches a specific poll using the provided
pollId
.Optionally listens for real-time updates on the poll.
Returns the poll object and a function to refetch the poll.
usePolls
usePolls
Fetches a paginated list of all polls.
Returns the list of polls and a function to refetch the list.
usePollz
usePollz
Retrieves the Pollz SDK instance and initialization status.
Ensures that the component is wrapped within the
PollzProvider
.
Usage Example:
This package provides a clean and convenient way for React developers to integrate Pollz functionality into their applications. If you have specific questions or need further assistance, feel free to let me know!
Last updated