Pass data from page to another

Viewed 9725

I recently started working with next.js, although I already have some experience with react, I have the following folder structure:

/segments 
  -index.js
  -[slug].js

Scenario: On page [url] / segments I get the list of segments by making a call to my api, which returns an array with all the information for each segment -> I display the list of segments for the user -> User chooses the segment and navigates to [url] / segments / slug. At this point I would like that on this page [slug] .js to receive the segment that the user chose (since everything I need is already in the object) without the need for another call to the api. I know I can use context for this, but I was wondering if next.js can solve this problem without having to use the global scope. Just passing a fetched data on one page to another. Thanks All

1 Answers
Related