Typeerror: Right Side of Assignment Cannot Be Destructured on Array Map
I Got: Typeerror: Right Side of Assignment Cannot Be Destructured Error When I Try to Get Array Object's Proprieties in One Function in React. Do You Know Guys...
I got:
TypeError: Right side of assignment cannot be destructured
error when I try to get array object's proprieties in one function in React. Do you know guys how to resolve this error? The array have only one object
costs (){
return this.state.costs.map(({ rent, utilities, accounting, glass, contractor, gas}) => ({
rent: rent || 0,
utilities: utilities || 0,
accounting: accounting || 0,
glass: glass || 0,
contractor: contractor || 0,
gas: gas || 0,
}))[0]
}
render () {
const { rent, utilities, accounting, glass, contractor, gas} = this.costs();
console.log( rent, utilities, accounting, glass, contractor, gas)
return (.........