score:2

Accepted answer

you cannot append a text element to a circle. first, create a g for each node:

var node = svg.append("g")
  .attr("class", "nodes")
  .selectall("g")
  .data(props.data)
  .enter()
  .append("g")

then, append a circle and a text to each g:

node.append('circle').attr('r', ...)
node.append('text').text(...)
...

replace

node.attr("cx", function(d) { return d.x; })
  .attr("cy", function(d) { return d.y; });

with:

node.attr('transform', d => `translate(${d.x},${d.y})`);

Related Query

More Query from same tag