JSFiddle - React, Tailwind, and code Playground

by incutonez

JavaScript

class Parent {
  set(field, value) {
    for (const key in field) {
      Reflect.set(this, key, field[key]);
    }
    console.log('Parent after setting:', this.Values)
  }
}

class Child extends Parent {
  // If I remove this, then my use case works, but I want a default value
  Values = [];

  constructor(args) {
  	super(args);
    this.set(args);
  }
}

var child = new Child({
})

console.log('Child getting:', child.Values)