title: Return data from custom Hook calling a graphql query
body: <p>I am new to <code>graphql and react.</code>. Here , I have following method,</p>
  
  <pre><code>export const useName = (isRequest: boolean) =&gt; {
    const {
      nav: { id, idme }
    } = stores
    if (buyingSession) {
      const { data, loading,error}
      = usegroup(id, {
        fetchPolicy: 'cache-and-network'
      })
    } else {
      const {data} = usesingle(idme)
  
    }
    return data;
  }
  </code></pre>
  
  <p>//This function should return a string which will be in data object.But I am getting confused over here because its a query and it takes time so it returns undefined but when I checked in the network it gives response as well.</p>
  
  <pre><code>export const useme = (id: string) =&gt; {
    return useQuery(GET_ME, {
      fetchPolicy: "cache-first",
      skip: !id,
      variables: {
        id: id
      }
    } 
  </code></pre>
  
  <p>In another component , I am calling ,</p>
  
  <pre><code>const data = useName(true)
  </code></pre>
  
  <p>So, this is the call which actually calls the graphql query. Now , when I am getting data it gets undefined.</p>
  
  <p>How do resolve this issue ?</p>