第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

鍵入 '{ 數(shù)據(jù): 受邀用戶[];“”: any; }'不可分配給類型“元素”

鍵入 '{ 數(shù)據(jù): 受邀用戶[];“”: any; }'不可分配給類型“元素”

胡子哥哥 2022-08-18 15:41:17
    我有一個打字腳本問題,如果可能的話,我需要一些幫助。我有一個父組件,它將一組結(jié)果傳遞到一個子組件,然后我將映射該子組件以顯示信息。父組件: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 componenttype 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>    );  }}
查看完整描述

2 回答

?
一只甜甜圈

TA貢獻(xiàn)1836條經(jīng)驗 獲得超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>

);


查看完整回答
反對 回復(fù) 2022-08-18
?
慕的地6264312

TA貢獻(xiàn)1817條經(jīng)驗 獲得超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;

導(dǎo)出的數(shù)據(jù)類型:


  firstName: string;

  lastName: string;

  createdOn: string;

  username: string;

  updatedOn: string;

  id: string;

  invitedState: string;

  invitedBy: {

    name: string;

    avatar: string;

    id: string;

    username: string;

  }

};```


查看完整回答
反對 回復(fù) 2022-08-18
  • 2 回答
  • 0 關(guān)注
  • 116 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號