LK
Size: a a a
LK
SG
LK
LK
NG
addSpecification = ( e ) => {
const target = e.target.getAttribute('data-target')
console.log(target)
this.setState(( { target } ) => ( {
target: { ...target, count: target.count + 1 },
} ))
}LK
LK
SG
target изначально?NG
target изначально?SG
SG
AP
SG
SG
nullNG
NG
NG
NG
addSpecification = ( e ) => {
const target = e.target.getAttribute('data-target')
this.setState(( { specifications } ) => ( {
specifications: { ...specifications, count: specifications.count + 1 },
} ))
}
Как можно вот это отрефакторить, чтобы вместо specifications прилетали любые другие поля, чтобы обработчик события стал универсальным?MK
MK