import React from 'react'; import './App.less'; import {gql, useQuery, useSubscription} from "@apollo/client"; import { Table } from 'antd'; interface User { id: number code: string name: string } interface Account { id: number code: string balance: number user: User } interface AccountResult { fetchAccounts: Array } const ACCOUNTS = gql` { fetchAccounts { id code balance user { code name } } } ` const SUB_ACCOUNTS = gql` subscription { fetchAccounts { id code balance user { code name } } } ` const HELLO = gql` subscription { hello } ` const accountColumns = [ { title: "Account ID", dataIndex: "id", key: "id", }, { title: "Account Code", dataIndex: "code", key: "code", }, { title: "User", dataIndex: ["user", "name"], key: "user.name", } ] function App() { // const {error, loading, data} = useQuery(ACCOUNTS) const {error, loading, data} = useSubscription(SUB_ACCOUNTS) // const {error, loading, data} = useSubscription(HELLO) console.log(data) return ( <>

Accounts

{ loading || !data ?

Loading...

: // data.fetchAccounts.map(account => ( // <> //
Account ID: {account.id}
//
Account Code: {account.code}
//
Account User: {account.user.name}
// // ) // ) //

{`${data.hello}`}

} ); } export default App;