0

I tried to use below object as default in apollo-link-state

 apolloClientDemo: {
  __typename: 'ApolloClientDemo',      
    currentPageName: 'Apollo Demo Default...',
    pages: ["page1", "page2"],
    pageObj:{
        color:"red",
        width:"100"
    }      
}

Then I tried to obtain pages array and pageObj inside ApolloClient Query component. While I could obtain pages array, couldn't obtain pageObj.

My query is like below;

 query {
     apolloClientDemo @client {
         currentPageName
         pages
         pageObj 
     }   
 }

Is there a way to use such nested objects as defaults in apollo-link-state?

Thanks

killjoy
  • 864
  • 17
  • 31

1 Answers1

0

You have to define the fields of "pageObj" you want to fetch in your query. More like this:

query {
     apolloClientDemo @client {
         currentPageName
         pages
         pageObj {
              color
              width
         }
     }   
 }

Hope this gives you an idea :)

curiosity
  • 388
  • 1
  • 13