memberEntitiy:
export interface MemberEntity {
id: number;
name: string;
code: string;
}
const useMemberCollection = () => {
const [memberCollection, setMemberCollection] = React.useState<MemberEntity[]>([]);
const loadMemberCollection = () => {
getMembersCollection().then(memberCollection =>
setMemberCollection(memberCollection)
);
};
return { memberCollection, loadMemberCollection };
};
export const MemberTableComponent = () => {
const { memberCollection, loadMemberCollection } = useMemberCollection();
React.useEffect(() => {
loadMemberCollection();
}, []);