2 回答
TA贡献1836条经验 获得超5个赞
从最高的组件删除:ReactNode
const CUserInvitations: React.FC<{}> = (): JSX.Element => (
<Query query={INVITED_USERS}>
{({ loading, data }: QueryResult<Array<InvitedUser>>): ReactNode => {
if (loading) {
return null;
}
if (!data) return null;
return <UserInvitations data={data} />;
}}
</Query>
);
TA贡献1817条经验 获得超6个赞
最高分量:
import { Query, QueryResult } from 'react-apollo';
import UserInvitations from '../components/userInvitations/UserInvitations';
import { InvitedUser } from '../components/common/types/userInvitations';
import { INVITED_USERS } from '../components/common/Queries';
/**
* the container for the user invitations
* renders the expense page wrapped by a query.
*/
const CUserInvitations: React.FC<{}> = (): JSX.Element => (
<Query query={INVITED_USERS}>
{({ loading, data }: QueryResult<Array<InvitedUser>>): ReactNode => {
if (loading) {
return null;
}
if (!data) return null;
return <UserInvitations data={data} />;
}}
</Query>
);
export default CUserInvitations;
导出的数据类型:
firstName: string;
lastName: string;
createdOn: string;
username: string;
updatedOn: string;
id: string;
invitedState: string;
invitedBy: {
name: string;
avatar: string;
id: string;
username: string;
}
};```
添加回答
举报