usePollAnswersPagination

A hook that queries answers for a given Poll and returns them in a paginated fashion. It can be used whenever we want to view all answers in a given poll, like in the PollAnswersList 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

paginationParams

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

Its type can be found here under the name PollAnswersQueryParams.

Type
object

Return type

The usePollAnswersPagination hook returns an object containing pagination values for the poll’s answers.

error

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

Type
object

hasNextPage

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

Type
boolean

loading

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

Type
boolean

loadMore

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

Type
() => void

next

A reference to the next cursor in the pagination.

Type
string

pollAnswers

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

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