useInfiniteScroll基本介绍 useInfiniteScroll 封装了常见的无限滚动逻辑。 const { data, loading, loadingMore, loadMore } = useInfiniteScroll(service); useInfiniteScroll 的第一个参数 service 是一个异步函数,对这个函数的入参和出参有如下约定: 假如第一次请求返回数据为 { list: [1, 2, 3] }, 第二次返回的数据为 { list: [4, 5, 6] }, 则我们会自动合并 list,整合后的的 data 为 { list: [1, 2, 3, 4, 5, 6] }。 其他参数及API请访问官网:https://ahooks.js.org/zh-CN/hooks/use-infinite-scroll 实际使用 import './styles.less'; import { useEffect, useRef, useState } from 'react'; import { useInfiniteScroll } from...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with return loadNotice
Contact return loadNotice, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack