Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gHashTag
Last active July 30, 2019 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gHashTag/79b26581785a23f9376bb860fa324f6c to your computer and use it in GitHub Desktop.
Save gHashTag/79b26581785a23f9376bb860fa324f6c to your computer and use it in GitHub Desktop.
Apollo Link State. Set local storage.
import { useApolloClient } from 'react-apollo-hooks'
const App = () => {
const client = useApolloClient()
const onPress = elem => () => client.writeData({ data: { elem } })
return (
<View>
<TouchableOpacity onPress={onPress('text')}>
<Text>Set</Text>
</TouchableOpacity>
</View>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment