I have the following test data where a single test-course
has three units which each has multiple subunits.
I am able to retrieve all subunits in one unit at a time using react-firebase-hooks
like below:
const [units, loading, error] = useCollection(
session && query(collection(db, "courses", "test-course", "unit-1"))
);
However, is there a way to fetch all units & subunits under a test-course? My goal is to render all of those units and subunits like this screenshot.
Or is there a better way to structure this data? Previous methods I thought of were:
- putting all subunit objects in one collection; but this seemed unintuitive as I need to track data/progress for each unit independently from one another