You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/api/link/introduction.mdx
+11-43Lines changed: 11 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,50 +91,25 @@ No matter how your chain branches, each branch always ends in a [terminating lin
91
91
92
92
#### Additive composition
93
93
94
-
Additive composition composes a link chain by executing links in serial order. You use the [`from`](#from) and [`concat`](#concat) helpers to create a link chain using additive composition.
94
+
Additive composition composes a link chain by executing links in serial order. You use the [`ApolloLink.from`](#apollolinkfrom) and [`ApolloLink.concat`](#apollolinkconcat) helpers to create a link chain using additive composition.
95
95
96
-
##### `from`
96
+
##### `ApolloLink.from`
97
97
98
-
The most common way to compose multiple links together is to use the `from` helper. Pass an array of link objects to `from` to create a composed link that executes each link in serial order:
98
+
The most common way to compose multiple links together is to use the static `ApolloLink.from` helper. Pass an array of link objects to `ApolloLink.from` to create a composed link that executes each link in serial order:
Each link object includes a `concat` instance method to combine two links into a single composed link. This is useful to combine multiple links together using a chain of function calls:
140
115
@@ -156,28 +131,21 @@ The link chain created by the `from` and `concat` examples are functionally equi
156
131
157
132
#### Directional composition
158
133
159
-
You might want your link chain's execution to branch, depending on the details of the operation being performed. You use the `split`function to create a link that conditionally routes to different sub-chains.
134
+
You might want your link chain's execution to branch, depending on the details of the operation being performed. You use the `ApolloLink.split`method to create a link that conditionally routes to different sub-chains.
160
135
161
-
The `split` function takes three arguments:
136
+
The `ApolloLink.split` function takes three arguments:
|`test`| A function that takes in the current `operation` and returns `true` or `false`. Returning `true` executes the `left` link. Returning `false` executes the `right` link. |
166
141
|`left`| The link passed as the second argument to `split`. This link executes when the `test` function returns `true`. |
167
142
|`right`| An optional link passed as the third argument to `split`. This link executes when the `test` function returns `false`. If this is not provided, the request handler's `forward` parameter is used. |
168
143
169
-
The following example uses `split` to create a link that routes to different `HttpLink` instances depending on the associated context's `version`:
144
+
The following example uses `ApolloLink.split` to create a link that routes to different `HttpLink` instances depending on the associated context's `version`:
0 commit comments