Reputation: 1513
I am working on a react native app. I am using Visual Studio Code for my work. Why I am getting that red color alert in my code.
When I hover on it I get
"[ts] Property 'loading' does not exist on type 'Readonly<{ children?: ReactNode; }> & Readonly<{}>'.
any"
I dont think there is any issue with my code but still It shows red. Can anybody tell me what is this issue.
Upvotes: 0
Views: 848
Reputation: 530
You must declare your loading in props. Here is a small example:
type BooksTableProps = {
readonly data: Array<data>;
readonly pagination: Pagination;
readonly loading: boolean;
readonly error: string; // or whatever
actions here
}
Use the loading in your render method:
render() {
const {
loading,
pagination,
data,
} = this.props;
return (
<div>
<Table
columns={this.columns}
dataSource={data}
loading={loading}
pagination={pagination}
onChange={this.handleTableChange}
/>
</div>
)
}
Upvotes: 1