JSFiddle - React, Tailwind, and code Playground

JavaScript

const impl = Symbol("impl")

class Foo {
  get bar() {
    return this[impl].bar;
  }
}

class FooImpl {
  constructor(bar) {
    this.bar = bar;
  }

  get(target, prop, receiver) {
    return prop == impl ? this : Reflect.get(...arguments);
  }
}

const foo_impl = new FooImpl(42);
const foo = new Proxy(new Foo(), foo_impl);

console.log(foo.bar);