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.
import React, { useMemo, useState, useReducer, useEffect, useCallback } from 'react';
import getAllFaqs from './faqQuery.graphql';
import { useFaq } from '../../peregrine/talons/Faq/useFaq';
const Faq = props => {
const [state, setState] = useState({})
const talonProps = useFaq({
query: getAllFaqs
});
const { data, error, loading } = talonProps;
setState({data})
console.log("Thank data", state)
return (<div>its Working</div>);
};