"Must Use Destructuring State Assignment": How To Destructure From Object And Place On Property Inside Object Literal
In a React project, I'm wanting to quickly troubleshoot things by logging specific parts of state at certain times. console.error('this.state.thing', this.state.thing); Doing this
Solution 1:
Not inside the literal, but you can destructure values into object properties:
({thing: objectLiteral.thing} = this.state);
Solution 2:
Yes, you can do it through arrow function
console.error('this.state.thing', (obj => obj.thing)(this.state))
Post a Comment for ""Must Use Destructuring State Assignment": How To Destructure From Object And Place On Property Inside Object Literal"