Skip to content

Instantly share code, notes, and snippets.

@nicolaslopezj
Created October 12, 2016 23:47
Show Gist options
  • Save nicolaslopezj/39a5f8bea711e52b92b88717eca2104b to your computer and use it in GitHub Desktop.
Save nicolaslopezj/39a5f8bea711e52b92b88717eca2104b to your computer and use it in GitHub Desktop.
// Main.js
import withGraphQL from 'react-apollo-decorators/lib/withGraphQL'
import gql from 'graphql-tag'
import Content from './Content'
@withGraphQL(gql`query getMyData ($section: String) {
dataForSection (section: $section) {
...${Content.fragmentName}
}
}`, {
fragments: [...Content.fragment]
})
export default class Main extends React.Component {
}
// Content.js
import React from 'react'
import withFragment from 'react-apollo-decorators/lib/withFragment'
import gql from 'graphql-tag'
@withFragment(gql`fragment dataContent on Data {
title
description
}`)
export default class Content extends React.Component {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment