Use Graphql backreference to avoid circular dependencies between Content model

Khaled Garbaya
InstructorKhaled Garbaya

Share this video with your friends

Send Tweet

In this lesson, you will learn how to use the Graphql backreferences created by Gatsby to get more data from a parent content type.

In this example, we have a lesson that references an instructor but the instructor content type does not have any data about the lessons that are assigned to it. Usually, you would create a reference back in the instructor content type to the lesson but this can cause a circular reference that's hard to maintain. Fortunately in the Gatsby data layer, GraphQL, we can query the parent node to get its data from its child. That's called backreference.