我有一个打字脚本问题,如果可能的话,我需要一些帮助。
我有一个父组件,它将一组结果传递到一个子组件,然后我将映射该子组件以显示信息。
父组件:
import { Table } from 'semantic-ui-react';
import { InvitedUser } from '../common/types/userInvitations';
import EmptyUserInvitesTable from './EmptyUserInvitesTable';
import UserInvitesTable from './UserInvitesTable';
// Type that sets up the prop types for props passed into
// the component
type UserInvitationsProps = {
data: Array<InvitedUser>;
};
// Class which contains the User Signup form and keeps the values in state, ready to be sent to the API.
class UserInvitations extends Component<
UserInvitationsProps
> {
render(): JSX.Element {
const { data } = this.props;
let showData = false;
if (data) {
showData = true;
}
return (
<div className="row settings-column">
<div className="userInvitesWidth">
<div className="row form-title align-column">
<Table striped>
<Table.Header>
<Table.Row>
<Table.HeaderCell />
<Table.HeaderCell>Invitee</Table.HeaderCell>
<Table.HeaderCell>Email Address</Table.HeaderCell>
<Table.HeaderCell>Invited By</Table.HeaderCell>
<Table.HeaderCell>Email Address</Table.HeaderCell>
<Table.HeaderCell>Date Invited</Table.HeaderCell>
<Table.HeaderCell>Date Joined</Table.HeaderCell>
<Table.HeaderCell>Actions</Table.HeaderCell>
</Table.Row>
</Table.Header>
{showData
? (
<EmptyUserInvitesTable />
)
: (
<UserInvitesTable data={data}/>
)}
</Table>
</div>
</div>
</div>
);
}
}
一只甜甜圈
慕的地6264312
相关分类