Should a react layout component be responsible for initial required data fetching.

So I am building a dashboard for a course page. There are different routes that the course page can have. For example /courses/9 /courses/9/settings /courses/9/members etc Each of these pages shares the same header (includes course name, metadata stuff, and the tabs to change pages) The role the user has in that course is fetched in the data the header uses to get its data. To avoid repeating the header on every course page, I think making a layout could be a solution. However, I need the data the header uses in each of the pages as well. So, I guess since I’m using SWR I can just use the same api key and get the data instantly without another fetch, or I can figure or some other way. Does this make sense? Any ideas?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server