Open GraphQL
Published in

Open GraphQL

Abhi Aiyer

Jun 17, 2018

4 min read

Fragment Driven UIs with Apollo

Today I want to share a cool pattern I’ve been using in my React Apollo applications.

I was working on a feature recently where I needed to fetch some user data to determine if the current user had a specific “role”. Based on that role, we would render you a UI component that only that role could view.

Pretty easy right? Because this component was deep in the application hierarchy we can take advantage of one of my favorite features in Apollo Client: caching.