0

1st type

      {this.state.persons.map((person,index) => {
        return (
          <Person
            name={person.name}
            age={person.age}
            click={()=>this.deletePersonHandler(index)}
          ></Person>
        )
      })}

2nd type

      {this.state.persons.map(person => {
        return (
          <Person
            name={person.name}
            age={person.age}
            click={deletePersonHandler(index)}
          ></Person>
        )
      })}

The code above should delete the specific person from the state, but why is the 2nd type not working, i need to know the difference between the two function calls.

0 Answers0