Answers for "react native how to pass id from list to function"

0

react native how to pass id from list to function

render(){
    return(
      <ul id="todo">
      {this.state.items.map((item,i) => 
        <li className='list-group-item' key={i} data-id={item.id}>{item.name}
        <button onClick={() => this.yourfunc(item.id)}>X</button>
        </li>
      )}
      </ul>
    ) 
}
Posted by: Guest on February-27-2021

Code answers related to "react native how to pass id from list to function"

Code answers related to "Javascript"

Browse Popular Code Answers by Language