score:6

Accepted answer

When you set up your click handler like this:

.on("click", (d) => click(d))

The fat-arrow notation preserves the context of this, so it's referring to the instance of your class.

Your handler, though:

function click(d) {
    d3.select(this).select("circle").transition()
        .duration(750)
        .attr("r", 16);
}

Is expecting this to be the g that was clicked.

So, set up your handler like:

.on("click", click)

Related Query