On the problem of data assignment

in state in react, declare this:

constructor (props) {

super(props);
this.state = {
  get leftCover() {
    let index = 0;
    let data =undefined;
    
    data={  //
      "img": props.list[index].img,
      "status": props.list[index].status,
      "title": props.list[index].title,
      "subTitle": props.list[index].subTitle,
      "index": props.list[index].index
    }
  }
};

}

screenshot of error report:

Mar.10,2021

you need to send data return out, otherwise: state.leftCover is undefined .

 

those attributes cannot be placed directly on the component , and some of them are not legal.

it's already stated in the error message. If you want to customize the property, put data-* to do it

that's not the problem, but when you use these state

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb27ba-4f8ad.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb27ba-4f8ad.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?