Using fetched data across all components.
Unanswered
RushO posted this in #help-forum
RushOOP
I am working on a Discord Bot Dashboard project with nextjs, and I've used NextAuth for signin users with their discord accounts.
Now I need to know how can I fetch guilds data of those users using discord's
I also need the data to be upto date (means even a slight change to the guilds in discord needs to be upto date in my app after a page refresh by the user), and stay away from hitting the rate limits at the same time.
I am a beginner to react.js and next.js, so I am looking for a solution to achieve this.
- Single route or function to handle data fetching and making the data available across the app to avoid using fetch on each component that requires the data, to reduce unnecessary api calls.
Now I need to know how can I fetch guilds data of those users using discord's
/users/@me/guilds
endpoint on a single api route of my app, and use those fetched data across all components that's gonna need those data without having to call the API again inside those components.I also need the data to be upto date (means even a slight change to the guilds in discord needs to be upto date in my app after a page refresh by the user), and stay away from hitting the rate limits at the same time.
I am a beginner to react.js and next.js, so I am looking for a solution to achieve this.
- Single route or function to handle data fetching and making the data available across the app to avoid using fetch on each component that requires the data, to reduce unnecessary api calls.