JSFiddle - React, Tailwind, and code Playground
HTML
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" style="width:200px;height:200px;">
<text x="50" y="30" fill="red" text-anchor="start">I love SVG</text>
</svg>
JavaScript
var dragMove = function (d,i) {
//d3.select(this).attr("text-anchor", "null");
d3.select(this).attr("x", d3.event.x)
.attr("y", d3.event.y);
};
var dragEnd = function (d,i) {
//d3.select(this).attr("text-anchor", "start");
};
var drag = d3.behavior.drag()
.on("drag", dragMove)
.on("dragend", dragEnd);
d3.select("svg")
.select("text")
.call(drag);