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
/courses
gets all classes you are enrolled in (of type
CourseData[]
CourseData[]
)
GET
/courses/:course_id
/courses/:course_id
gets specific details for one course (of type
CourseData
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?