JSFiddle - React, Tailwind, and code Playground

JavaScript

/* no export */ const $internal = new WeakMap();
/* no export */ function internal(key) {
	let store = $internal.get(key);
  if (!store) {
  	store = Object.create(null);
    $internal.set(key, store);
  }
  return store;
}

/* export */ class Foo {
  constructor(v) {
  	internal(this).v = v;
  }
  get v() {
    return internal(this).v * 2;
  }
}

let a = new Foo(1);
let b = new Foo(2);
console.log(a.v, b.v); // 2, 4
a.v = 'x';
a.v = 'y';
console.log(a.v, b.v); // 2, 4