Next.js Discord

Discord Forum

Planning a dynamic component

Unanswered
Hooded Oriole posted this in #help-forum
Open in Discord
Hooded OrioleOP
Hello. I'm kinda new to NextJS and I'm planning (on my head, not on the code yet) a modal component that fetches data from API and shows it to the user. But, while it's fetching the data, I would like to use react's suspense to make a skeleton appear. The data fetched would be information about a random book. The problem I'm facing is that I would also like to have inside this modal a "give me another book" button that, when clicked, would make the first-mentioned component fetch some other data again. But the button would have to kinda "tell" the other component to go and fetch data again. How can that be done?

If I was unclear, please just tell me and I'll try to explain in a better way. Thank you!

0 Replies