Skip to main content

useCreatePoll

Introduction​

The useCreatePoll hook is used to create a poll conversation object through the implementation of poll creation dialog. You can use this hook to create a custom UI for poll creation dialog box.

PropertyTypeDescriptionOptional
pollOptionsPollOption[]The list of options available in the poll.❌
addPollOptionZeroArgVoidReturnsAdds a new option to the poll.❌
updatePollOptionTwoArgVoidReturns<string, number>Updates a specific poll option by index.❌
removePollOptionOneArgVoidReturnsRemoves a poll option by index.❌
createPollConversationZeroArgVoidReturnsCreates a new poll conversation.❌
changePollTextOneArgVoidReturns <React.ChangeEvent<HTMLTextAreaElementS> S>Updates the poll question text.❌
pollTextstringThe text of the poll question.❌
updatePollExpirationDateOneArgVoidReturns number | nullUpdates the expiration date of the poll.❌
pollExpirationDatenumber | nullThe expiration date of the poll (timestamp), or null.❌
advancedOptionsAdvancedPollOptionsConfiguration options for advanced poll settings.❌
updateAdvancedOptionsOneArgVoidReturns React.ChangeEvent<HTMLInputElementS> | SelectChangeEvent<numberS>Updates advanced poll settings based on user input.❌

PollOption​

PropertyTypeDescriptionOptional
textstringThe text of the poll option.❌

AdvancedPollOptions​

PropertyTypeDescriptionOptional
ALLOW_VOTERS_TO_ADD_OPTIONSbooleanAllows voters to add new options to the poll.❌
ALLOW_ANONYMOUS_VOTINGbooleanEnables anonymous voting in the poll.❌
SHOW_LIVE_RESULTSbooleanDisplays live results as votes are cast.❌
MULTIPLE_SELECTION_STATEnumberDefines the state for multiple selection.❌
MULTIPLE_SELECTION_NOnumberThe number of selections allowed per voter.❌

Reference​

For reference checkout this file