Skip to main content

usePolls

Introduction

The usePolls hook is used to interact with the poll type message object. You can use this to implement your custom UI for poll type conversations.

PropertyTypeDescription
submitPollZeroArgVoidReturnsFunction to submit the poll.
addOptionOnPollZeroArgVoidReturnsFunction to add an option to the poll.
getPollUsersOneArgVoidReturnsFunction to fetch users who interacted with the poll.
selectPollOptionOneArgVoidReturns<React.MouseEvent<HTMLDivElement>>Function to select a poll option.
temporaryAddOptionTextstringText value for a temporarily added poll option.
setTemporaryAddOptionTextReact.Dispatch<React.SetStateAction<string>>Function to update the temporary poll option text.
selectedPollOptionsSelectedPollOption[]List of selected poll options.
calculateAddPollOptionButtonVisibilityZeroArgVoidReturnsFunction to determine if the "Add Option" button should be shown.
calculateSubmitButtonVisibilityZeroArgVoidReturnsFunction to determine if the "Submit" button should be shown.
pollUsersMember[]List of users who interacted with the poll.

SelectedPollOption

PropertyTypeDescription
idstringUnique identifier of the poll option.

Reference

For reference checkout this file