React Hooks in Apollo client for GraphQL queries and mutations

David Mráz
Atheros
Published in
5 min readMay 21, 2019

--

(This article is also available on atheros.ai without the paywall.)

Introduction

The hype following the last React conference has diminished. The proposal for React Hooks was introduced as part of the React alpha release. Since React v16.8, React Hooks have been in all official release as well. How does this improvement affect how we build our apps with GraphQL? We usually take our time before introducing new tech features in our projects at Atheros. This will allow us to not jump on the false hypes. React Hooks are now tested and production-ready, so we took a shot on implementing it in our projects as well. React Hooks is a new way how to reduce the need for React component classes and their life-cycle methods. They also solve other problems related to using HOC (Higher-order component) or render props pattern. There are a lot of resources on React Hooks and I will not go deep into them from React standpoint in this article. You can check out the following talk from the recent conference

--

--

David Mráz
Atheros

Founder of https://atheros.ai | Artificial Intelligence | Machine Learning | JavaScript, Python, C++ | Business