How to transfer data from an object to separate variables, so that when using each time you do not write object.name, object.text, etc.?
const { object } = this.props; that doesn't work. undefined
conxt {text} = object.text How to transfer data from an object to separate variables, so that when using each time you do not write object.name, object.text, etc.?
const { object } = this.props; that doesn't work. undefined
conxt {text} = object.text This is called object restructuring.
const object = { name: 'name1', text: 'text1' } const { name, text } = object; console.log(name, text) If you have props undefined, then object will also be undefined. Check what this is tied to.
Source: https://ru.stackoverflow.com/questions/683834/
All Articles