queries graphql code example

Example 1: graphql mutation passing data

input EventInput {
    title:String!
    desc:String!
    price:Float!
  }
  type RootMutations{
    createEvent(E_input:EventInput) : Event
  }

Example 2: query sequnce graphql

export default compose(
  graphql(firstQuery, {
    name: 'firstQuery'
  }),
  graphql(secondQuery, { 
    name: 'secondQuery',
    skip: ({ firstQuery }) => !firstQuery.data,
    options: ({firstQuery}) => ({
      variables: {
          var1: firstQuery.data.someQuery.someValue
      }
    })
  })
)(withRouter(TestPage))

Example 3: query sequnce graphql


  {({ data: { someQuery: { someValue } = {} } = {} }) => (
    
      {({ data: secondQueryData }) => (
        // your component here
      )}

Tags:

Misc Example