Skip to content

Commit

Permalink
Update fragment's definition in Learn-Queries.md
Browse files Browse the repository at this point in the history
Changing the wording on the description of fragments to nudge people towards a more clear usage, like what Relay.dev does.
  • Loading branch information
inlineblock committed Oct 13, 2023
1 parent 82ddb6f commit 497aa7b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/content/learn/Learn-Queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ That's why GraphQL includes reusable units called _fragments_. Fragments let you
}
}

# used by the comparison UI component
fragment comparisonFields on Character {
name
appearsIn
Expand All @@ -119,7 +120,7 @@ fragment comparisonFields on Character {
}
```

You can see how the above query would be pretty repetitive if the fields were repeated. The concept of fragments is frequently used to split complicated application data requirements into smaller chunks, especially when you need to combine lots of UI components with different fragments into one initial data fetch.
You can see how the above query would be pretty repetitive if the fields were repeated. The concept of fragments is frequently used to define data requirements of a UI component or utility, creating smaller composable chunks. This is especially beneficial when you need to combine lots of UI components with different fragments into one initial data fetch.

### Using variables inside fragments

Expand Down

0 comments on commit 497aa7b

Please sign in to comment.