import { Table, TableHeader, TableColumn, TableBody, TableRow, TableCell, Spinner, getKeyValue, } from "@heroui/react"; import {useInfiniteScroll} from "@heroui/use-infinite-scroll"; import {useAsyncList} from "@react-stately/data"; export default function App() { const [isLoading, setIsLoading] = React.useState(true); const [hasMore, setHasMore] = React.useState(false); let list = useAsyncList({ async load({signal, cursor}) { if (cursor) { setIsLoading(false); } // If no cursor is available, then we're loading the first page. // Otherwise, the cursor is the next URL to load, as returned from the previous page. const res = await fetch(cursor || "https://swapi.py4e.com/api/people/?search=", {signal}); let json = await res.json(); setHasMore(json.next !== null); return { items: json.results, cursor: json.next, }; }, }); const [loaderRef, scrollerRef] = useInfiniteScroll({hasMore, onLoadMore: list.loadMore}); return (