✅ – Alforoan – 03-36 Jan 4
if an api link gives me only one page of a collection of movies and i want multiple pages how do i combine the data?
i can get 2nd,3rd, 4th, etc. pages by changing the link at the end to page=(number)
Solution:Jump to solution
```js
const [currentPage, setCurrentPage] = useState(1);
const FetchMovies = async (page) => {
const response = await fetch(url+page);...
16 Replies
do you want to grab them all at once or when needed?
well actually i suppose i can just copy paste all of them into a data file, right
i wanted to grab them all at once
do you know ahead of time how many pages there are?
💀
yeah you probably don't want to load all of that at once
i was thinking add a load more button at the bottom
what would you use it all at once for?
ive never done it so i didnt know what u were asking for lol
if you're trying to do a load more
you'd just append the data to your state when you fetch it
so make multiple state hooks?
nah just one
for the fetching part, whats the diff btwn urs and something like this
i'm appending the data to the end of the
list
array whereas you're replacing the array
but you could do it like thisSolution
ok, that's helpful. ty 🙂
This question has an answer! Thank you for helping 😄
If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/902647189120118794/1060038954260373575
This thread hasn’t had any activity in 12 hours, so it’s now locked.
Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/902647189120118794/1060038954260373575