Best way to request unknown number of API pages in useEffect hook
问题 I'm trying to write a React functional component that requests a list of people exposed across multiple pages in an API: https://swapi.dev/api/people/?page=9 I know there are currently nine pages, but this might change in the future, so I want my component to keep requesting pages until there are no more, and to accumulate and store the people in the "results" bit of each response body. I'm trying to do this with useState and useEffect hooks. Is there a common way of solving this problem that