Skip to content

Commit

Permalink
Merge pull request #1 from manueliglesias/patch-1
Browse files Browse the repository at this point in the history
Update api_guide.md
  • Loading branch information
mbahar authored Apr 12, 2018
2 parents 026dcee + 5812573 commit 3c02324
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions docs/media/api_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,9 @@ class App extends React.Component {

return (
<Connect query={graphqlOperation(ListEvents)}>
{ listEvents }
{({ data: { listEvents } }) => (
<AllEvents events={listEvents.items} />
)}
</Connect>
)
}
Expand All @@ -521,15 +523,27 @@ Also, you can use `subscription` and `onSubscriptionMsg` attributes to enable su
onSubscriptionMsg={(prev, { subscribeToEventComments }) => {
console.log ( subscribeToEventComments);
return prev; }}>
{({ data: { listEvents } }) => (
<AllEvents events={listEvents ? listEvents.items : []} />
)}
</Connect>

```

For mutations, a `mutation` function will be provided in the render prop function. This function returns a promise that resolves with the result of the GraphQL mutation.





```js
class CreateEvent extends React.Component {
// ...
// This component calls its onCreate prop to trigger the mutation
// ...
}
<Connect mutation={graphqlOperation(Operations.CreateEvent)}>
{({ mutation }) => (
<CreateEvent onCreate={mutation} />
)}
</Connect>
```



Expand Down

0 comments on commit 3c02324

Please sign in to comment.