# Colocated fragments best practice for when multiple components needs to fetch same data

**URL:** https://community.apollographql.com/t/colocated-fragments-best-practice-for-when-multiple-components-needs-to-fetch-same-data/7572
**Category:** Schema Design
**Tags:** schema-design
**Created:** [May 30, 2024, 11:34pm UTC](https://community.apollographql.com/t/colocated-fragments-best-practice-for-when-multiple-components-needs-to-fetch-same-data/7572 "2024-05-30T23:34:49Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Jeff\_Apollo](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/jeff_apollo/32/5140_2.png) [@Jeff\_Apollo](https://community.apollographql.com/u/Jeff_Apollo)
#### Post date: [May 30, 2024, 11:34pm UTC](https://community.apollographql.com/t/colocated-fragments-best-practice-for-when-multiple-components-needs-to-fetch-same-data/7572/1 "2024-05-30T23:34:49Z")

</div>

Hi,

I am trying to understand the best practices when using colocated fragments. I understand that one of the best practice is to ensure that each component is responsible for its own data requirements. If we have multiple components that needs the same field, should both field be redefined in each of the component’s colocated fragment? Also, if the parent component needs the same field as the child component, should that field be fetched in both the parent component and child component’s colocated fragment?

Example:

```auto
query X {
    fieldA {
       id
       firstName
       lastName
       ....ComponentA
    }
}

fragment ComponentA {
  firstName
  lastName
}

fragment ComponentB {
  firstName
  lastName
}

```

---

<div class="post-metadata">

### Author: ![JeffAuriemma](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/jeffauriemma/32/2845_2.png) [@JeffAuriemma](https://community.apollographql.com/u/JeffAuriemma)
#### Post date: [June 3, 2024, 10:18am UTC](https://community.apollographql.com/t/colocated-fragments-best-practice-for-when-multiple-components-needs-to-fetch-same-data/7572/2 "2024-06-03T10:18:16Z")

</div>

Hi @Jeff_Apollo 👋 the short answer is: don’t worry about overlap, it’s fine to spread `ComponentA` and `ComponentB` into your query even if they happen to contain the same fields. The long answer is: it depends. If `ComponentA` and `ComponentB` are essentially variants of the same component, then you could consider having them share a fragment because it’s extremely unlikely that their data requirements will ever diverge. But in my experience this is not typical, so it’s probably best to declare two separate fragments like those in your snippet.
