SWR - array of data in one request, one item from array in another
So I am using SWR in my nextJS app and I have two routes
GET
/courses
gets all classes you are enrolled in (of type CourseData[]
)
GET /courses/:course_id
gets specific details for one course (of type CourseData
)
SWR does not know the relationship between these, so it refetches even tho we have the data from the all courses page. Does anyone know of a way to just use the data right away without requiring another fetch?1 Reply
Left is request to get all courses you are part of, right happens when you go to the specific page.