Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nafeu/1c8de1747b09c347ced8e9eb91acc773 to your computer and use it in GitHub Desktop.
Save nafeu/1c8de1747b09c347ced8e9eb91acc773 to your computer and use it in GitHub Desktop.
const TableQuery = () => {
const queryClient = useQueryClient();
const [tableData, setTableData] = useState(null);
const { data: apiResponse, isLoading } = useQuery('discussionGroups', fetchData);
useEffect(() => {
setTableData(apiResponse?.data);
}, [apiResponse])
if (isLoading || !tableData) {
return <div>Loading...</div>
}
return (
<TableInstance tableData={tableData}/>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment