JSFiddle - React, Tailwind, and code Playground
JavaScript
class MyClass {
constructor() {
this.points = [];
this.setupMyClass();
}
setupMyClass() {
let {points} = this;
points = [...points, {x: 20, y:20}];
// ugly code
//this.points = [...this.points, {x: 20, y: 20}];
console.log('points', points);
console.log('this.points', this.points);
}
}
myClassInstance = new MyClass();