When i tried run the below component it showing type issue in my declartion
Below is the issue what i am getting Type '{ First: string[]; Second: string[]; Third: string[]; Four: string[]; }' is missing the following properties from type 'any[]': length, pop, push, concat, and 28 more. TS2740
Interface headers declartion I have tried the headers data any,String,Array but it was not working
interface headers {
First: any[],
Second: any[],
Third: any[],
Four:any[],
}
const headers data declartion
const headers = {
First: [
'lara',
'dravid',
'sachin',
'Ganguly',
],
Second: [
'kohli',
'dhoni',
'smith',
'kane',
],
Third: [
'lee',
'mustaq',
'vaas',
'shane',
],
Four: [
'bumrah',
'starc',
'jadeja',
'shami',
],
};
Export state
export interface State {
headersList: Array<any>
}
Main component class
export class MyComp extends React.PureComponent<Props, State> {
constructor(props) {
super(props);
this.state = {
headersList: headers,
};
this.state = {
headersList: [headers],
};
Will fix the problem
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.