The binding event in the react parent component is invalid.

I want to add events to a build in a loop, but why not?


class Lesson extends Component {
  /* TODO */
  constructor(){
    super()
  }

  alertInfo(lesson,index){
    console.log(index+"-"+lesson.title)
  }


  
  render(){
    const lesson=this.props.lesson
    const index=this.props.index
    console.log(lesson)
    
    return(
      <div >
        <h1 onClick={this.alertInfo.bind(this,lesson,index)}>{ lesson.title }</h1>
        

{ lesson.description }

</div> ) } } class LessonsList extends Component { /* TODO */ constructor(){ super() } info(){ console.log(666) } render(){ const lessons = this.props.lessons console.log(lessons) return ( <div> { lessons.map((item,index)=> <Lesson lesson={item} key={index} index={index} onClick={()=>{console.log(666)}}/> ) } </div> ) } }
Mar.02,2021

Lesson how does the component write?


lesson does not write correctly
is modified to:
class Lesson extends Component {
/ TODO /
constructor () {

super()
this.alertInfo=this.alertInfo.bind(this)

}

alertInfo (lesson,index) {

console.log(index+"-"+lesson.title)

}

render () {

const {lesson,index}=this.props
console.log(lesson)

return(
  <div >
    <h1 onClick={()=>this.alertInfo(lesson,index)}>{ lesson.title }</h1>
    

{ lesson.description }

</div> )

}
}

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-1bee57f-30f4a.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-1bee57f-30f4a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?