title: React js using hooks useState infinite loop rendering?
body: <p>I want to update my component current state on result by using custom hook but when i update it showing me infinite loop rendering. by using useState() hook. I am new to react hooks.</p>
  <pre><code>import React, { useMemo, useState, useReducer, useEffect, useCallback } from 'react';
  import getAllFaqs from './faqQuery.graphql';
  import { useFaq } from '../../peregrine/talons/Faq/useFaq';
  
  const Faq = props =&gt; {
    const [state, setState] = useState({})
    const talonProps = useFaq({
      query: getAllFaqs
    });
    const { data, error, loading } = talonProps;
    setState({data})
  
    console.log(&quot;Thank data&quot;, state)
    return (&lt;div&gt;its Working&lt;/div&gt;);
  };
  </code></pre>