I'm wondering if there's a way to use destructuring in order to copy all properties of an object into this
without knowing the props.
class MyObject {
constructor(data) {
this.someFlag = true
// How can I destructure 'data' into this.
}
}
I've seen this answer (and some other) but they all have in common the knowledge of the properties to be copied or the usage of Object.assign
. I'm wondering how to do it using simple destructuring.