# Creating Query Components with Apollo

DevFeed: [Creating Query Components with Apollo](<https://devfeed.tech/articles/creating-query-components-with-apollo-27371.md>)

Original publisher: [Read original article](<http://engineering.khanacademy.org/posts/creating-query-components-with-apollo.htm>)

Author: Khan Academy

Published: 2017-06-12T22:00:00Z

Content type: article

Language: en

Sources: [Khan Academy](<https://devfeed.tech/sources/khan-academy.md>)

Topics: [GraphQL](<https://devfeed.tech/topics/graphql.md>), [apollo-client](<https://devfeed.tech/topics/apollo-client.md>), [React](<https://devfeed.tech/topics/react.md>)

Tags: [apollo](<https://devfeed.tech/tags/apollo.md>), [component](<https://devfeed.tech/tags/component.md>), [components](<https://devfeed.tech/tags/components.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [news](<https://devfeed.tech/tags/news.md>), [query](<https://devfeed.tech/tags/query.md>), [web-frontend](<https://devfeed.tech/tags/web-frontend.md>)

## AI overview

The article presents "Query Components" as a way to separate Apollo and GraphQL query handling from React presentation. Its SchoolsQuery component wraps the query, maps loading, empty, and error states plus school results into props, and passes them to a presentation component through a function-as-children callback. This leaves the presentation focused on rendering and lets the same query support different layouts. The example filters schools by postal code and uses Flow types; a similar wrapper can trigger mutations. The author says the pattern has been useful but is still being evaluated for scale, and suggests it could also work with REST APIs.

## Source excerpt

By Brian Genisio Here at Khan Academy, we've been using GraphQL in several projects with great success. GraphQL ... Read more