Created
November 26, 2021 13:25
-
-
Save sdanko/11ad379716b83cd9b4eb764949d794f7 to your computer and use it in GitHub Desktop.
React Apollo: Using Subscriptions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const messagesQuery = gql` | |
query MessagesQuery { | |
messages { | |
id | |
from | |
text | |
} | |
} | |
`; | |
const messageAddedSubscription = gql` | |
subscription { | |
messageAdded { | |
id | |
from | |
text | |
} | |
} | |
`; | |
const addMessageMutation = gql` | |
mutation AddMessageMutation($input: MessageInput!) { | |
message: addMessage(input: $input) { | |
id | |
from | |
text | |
} | |
} | |
`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment