usePollOptionVotesPagination

A hook that queries votes for a given option in a Poll and returns them in a paginated fashion. It can be used whenever we want to view all votes for an option in a given poll, like in the PollOptionFullResults component for example.

Properties

loadFirstPage

A property that depicts whether the hook should load the first page of answers when first invoked or not. Default to true if omitted.

Type
boolean

option *

The poll option that we want to query the votes for.

Type
object

paginationParams

An object containing the pagination parameters that we may want to pass to the hook that will then be used to query for votes.

Its type can be found here under the name PollOptionVotesQueryParams.

The { option_id: <option-id> } filter is mandatory and will be added regardless of overrides.

Type
object

Return type

The usePollOptionVotesPagination hook returns an object containing pagination values for the poll option’s votes.

error

An object containing an error if one is thrown during querying for the votes.

Type
object

hasNextPage

A property depicting whether the list of votes has a next page to load or not.

Type
boolean

loading

A property depicting whether the next page of votes is currently loading or not.

Type
boolean

loadMore

A function that loads the next page of votes whenever invoked. It will automatically update votes

Type
() => void

next

A reference to the next cursor in the pagination.

Type
string

vote

A list of votes that has been loaded so far. It automatically updates itself whenever loadMore() is invoked and triggers a state update.

Type
PollVote[]
© Getstream.io, Inc. All Rights Reserved.