From 79eeaad5d005080ce64ed83e74e3b81c7db99498 Mon Sep 17 00:00:00 2001 From: "gento.ogane" Date: Thu, 9 Nov 2023 19:01:39 +0900 Subject: [PATCH] [#11305]update subscriptions doc --- docs/source/data/subscriptions.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/data/subscriptions.mdx b/docs/source/data/subscriptions.mdx index c4c177c9784..91c7483fc3f 100644 --- a/docs/source/data/subscriptions.mdx +++ b/docs/source/data/subscriptions.mdx @@ -111,7 +111,7 @@ npm install graphql-ws Import and initialize a `GraphQLWsLink` object in the same project file where you initialize `ApolloClient`: -```js title="index.js" +```jsx title="main.jsx" import { GraphQLWsLink } from '@apollo/client/link/subscriptions'; import { createClient } from 'graphql-ws'; @@ -130,7 +130,7 @@ To support this, the `@apollo/client` library provides a `split` function that l The following example expands on the previous one by initializing both a `GraphQLWsLink` _and_ an `HttpLink`. It then uses the `split` function to combine those two `Link`s into a _single_ `Link` that uses one or the other according to the type of operation being executed. -```js title="index.js" +```jsx title="main.jsx" import { split, HttpLink } from '@apollo/client'; import { getMainDefinition } from '@apollo/client/utilities'; import { GraphQLWsLink } from '@apollo/client/link/subscriptions'; @@ -168,7 +168,7 @@ Using this logic, queries and mutations will use HTTP as normal, and subscriptio After you define your link chain, you provide it to Apollo Client via the `link` constructor option: -```js {6} title="index.js" +```jsx {6} title="main.jsx" import { ApolloClient, InMemoryCache } from '@apollo/client'; // ...code from the above example goes here...