diff --git a/docs/example-apollo.md b/docs/example-apollo.md new file mode 100644 index 0000000..36f59b5 --- /dev/null +++ b/docs/example-apollo.md @@ -0,0 +1,79 @@ +--- +id: example-apollo +title: Apollo +sidebar_label: Apollo +--- + +```javascript +import React, { useState } from 'react'; +import { gql, useMutation } from 'react-apollo'; +import { MockedProvider } from '@apollo/react-testing' +import { Button, TextInput, View } from 'react-native'; +import { render, fireEvent, act } from "@testing-library/react-native"; +import wait from "waait"; + +const UPDATE_EMAIL = gql` + mutation UpdateEmail($email: String!) { + updateEmail(email: $email) { + newEmail + } + } +`; + +function UpdateEmailForm() { + const [updateEmail, { data }] = useMutation(UPDATE_EMAIL); + const [email, setEmail] = useState(''); + + render() { + if (data) { + return ( +
Email successfully updated
+ ) + }; + + return ( +