Answer the question
In order to leave comments, you need to log in
How to get data from div field in React?
Hello everyone, there is a component, you need to click on the line with data (window_items) to get data from all internal blocks in order to work with them later, for example, delete
function FirstWindowItems({item}) {
function handleClick(element){
// e.preventDefault();
console.log(element);
}
return(
<div className = "window__items" onClick = {handleClick(element)}>
{/* <div className = "window__item window__name">{item.id}</div> */}
<div className = "window__item window__name">{item.FIO}</div>
<div className = "window__item window__name">{item.position}</div>
<div className = "window__item window__name">{item.birthDay}</div>
<div className = "window__item window__name">
{
item.sex ?
"М" : "Ж"
}
</div>
<div className = "window__item window__name">{
item.fired ?
"Уволен":"Работает"
}
</div>
</div>
)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question