How do I correctly use the refreshFunction function from the react-infinite-scroll-component library?

Viewed 115

I would like to update the list by pulling down, but I didn't quite understand how this method works.

How do I implement it?

<InfiniteScroll
        style={{ padding: '0 1rem 5rem 0rem', display: 'flex', flexDirection: 'column', gap: '1rem', userSelect: 'none' }}
        height='85vh'
        next={fetchData}
        dataLength={dataLength}
        hasMore={isPaginationEnd}
        refreshFunction={fetchData}
        pullDownToRefresh={true}
        pullDownToRefreshThreshold={50}
        pullDownToRefreshContent={<MessageComponent text='Puxe para baixo p/ atualizar' />}
        releaseToRefreshContent={<LoadingComponent />}
        loader={<LoadingComponent />}
    >
        {!hasData ? (
            <MessageContainer text='Você não possui nenhuma cotação solicitada, vamos criar uma nova?... ;)' />
        ) : (
            data.map(({ informations, parameters }) => (
                <QuotationAccordion key={informations.rfqId} informations={informations} parameters={parameters} />
            ))
        )}
    </InfiniteScroll>
0 Answers
Related