![]() ![]() The Relay Compiler is responsible for generating code as part of a build step which can then be referenced at runtime. With both runtime artifacts (which help to read and write from the Relay Store)Īnd Flow types to help you write type-safe code. Will cause a generated file to appear in. Component_internUser is included, instead of Relay's normal behavior to mask those fields: In the example below, the user prop will include the data for id and name fields wherever. Abusing this directive could result in over-fetching in your application. Keep in mind that it is typically considered an anti-pattern to create a single fragment shared across many containers. This may be helpful to reduce redundant fragments when dealing with nested or recursive data within a single Component. The Flow types will no longer be exact objects and no longer contain internal marker fields. However, false) can be used to prevent data masking when including a fragment and annotating it with false), its data will be available directly to the parent instead of being masked for a different container.Īpplied to a fragment definition, false) changes the generated Flow types to be better usable when the fragment is included with the same directive. is a directive used to pass arguments to a fragment that was defined using For Boolean) īy default Relay will only expose the data for fields explicitly requested by a component's fragment, which is known as data masking. ![]() Note: The relay-compiler will maintain any directives supported by your server (such as or so they remain part of the request to the GraphQL server and won't alter generated runtime artifacts. These directives only appear in your application code and are removed from requests sent to your GraphQL server. ![]() Relay uses directives to add additional information to GraphQL documents, which are used by the Relay Compiler to generate the appropriate runtime artifacts. The Relay Babel plugin will then convert the graphql literals in your code into require() calls for the generated files. Instead, they are compiled ahead of time by the Relay Compiler into generated artifacts that live alongside your source code, and which Relay requires to operate at runtime. Note that graphql template tags are never executed at runtime. The result of using the graphql template tag is a GraphQLTaggedNode a runtime representation of the GraphQL document which can be used to define Query Renderers, Fragment Containers, Refetch Containers, Pagination Containers, etc. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |