Skip to content

Instantly share code, notes, and snippets.

@bmcmahen
Created August 13, 2015 18:10
Show Gist options
  • Save bmcmahen/02269d7426d72927e274 to your computer and use it in GitHub Desktop.
Save bmcmahen/02269d7426d72927e274 to your computer and use it in GitHub Desktop.
Notes about relay, by facebook

Fragments vs Queries

Fragments are differentiated from queries insofar as they describe generic attributes of a certain type. If you are making a profile component, you will attach a fragment to that component describing the type of user fields that are needed, and how that data object should look. A query exists on the top of the component tree, and is closely associated with routes. You will have a route that provides a user id (probably from the browser url). This is passed as an argument to the query, and then the query includes the sub-fragments. This will then shape all of the data for you automatigically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment