class { onCreate() { this.callCount = 0; this.state = { list: [{ id: "foo", text: "Foo Text" }, { id: "bar", text: "Bar Text" }] } } calcKey(id) { this.callCount++; return `${id}`; } swap() { const [a, b] = this.state.list; this.state.list = [b, a]; } }