# Using GraphQL Fragments for safer, cleaner, and faster code

DevFeed: [Using GraphQL Fragments for safer, cleaner, and faster code](<https://devfeed.tech/articles/using-graphql-fragments-for-safer-cleaner-and-faster-code-23561.md>)

Original publisher: [Read original article](<https://www.apollographql.com/blog/using-graphql-fragments-for-safer-cleaner-and-faster-code>)

Author: Tim Hingston

Published: 2021-05-31T10:30:01Z

Content type: tutorial

Language: en

Sources: [Apollo Blog](<https://devfeed.tech/sources/apollo-blog.md>)

Topics: [GraphQL](<https://devfeed.tech/topics/graphql.md>), [Refactoring](<https://devfeed.tech/topics/refactoring.md>), [React](<https://devfeed.tech/topics/react.md>), [App](<https://devfeed.tech/topics/app.md>)

Tags: [building](<https://devfeed.tech/tags/building.md>), [code](<https://devfeed.tech/tags/code.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [react](<https://devfeed.tech/tags/react.md>), [refactor](<https://devfeed.tech/tags/refactor.md>)

## AI overview

This tutorial explains how GraphQL fragments can make component data dependencies clearer while supporting cleaner separation between parent and child components. It uses list components as examples and discusses refactoring components into separate files, including tradeoffs such as less discoverable and duplicated data dependencies.

## Source excerpt

Whether you're just getting started with building GraphQL applications or you've done it for years, you probably have a decent understanding of what GraphQL queries are. But what about GraphQL fragments? In this article, we'll delve into some common use-cases where fragments shine, learn how to get the most out of them, and hopefully, I'll inspire you to use more fragments in your GraphQL queries.