From 805fc5eb14f1d8b87adfa3af458a5a79a7343878 Mon Sep 17 00:00:00 2001 From: Andrico Karoulla Date: Thu, 16 Apr 2020 13:50:09 +0100 Subject: [PATCH 1/2] add apollo example --- docs/example-apollo.md | 73 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 docs/example-apollo.md diff --git a/docs/example-apollo.md b/docs/example-apollo.md new file mode 100644 index 0000000..f618334 --- /dev/null +++ b/docs/example-apollo.md @@ -0,0 +1,73 @@ +--- +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 [uppdateEmail, data] = useMutation(UPDATE_EMAIL); + const [email, setEmail] = useState(''); + + render() { + return ( + + setEmail({ text })} + /> +