I\'m using ReactJS, d3JS and ES6 to create an org chart. I can create the chart and see it. But I want to add the zoom behavior to the chart, so I used
If you are importing multiple d3 packages. these packages have a d3 object accessible which might clash with one another. you have to import them with different names.
import d3 from 'd3-selection'
import d3Zoom from 'd3-zoom'
import d3Scale from 'd3-scale'
and have a anonymous function for your callback
.on("zoom", () => d3.select("#viewport")
.attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
)