JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://d3js.org/topojson.v1.min.js"></script>
<h1>Drag to explore</h1>
<!--
http://stackoverflow.com/questions/21030503/how-to-run-mike-bostocks-d3-examples
http://bl.ocks.org/mbostock/6746848
http://bl.ocks.org/mbostock/3795040
-->
JavaScript + D3 3.x

CSS

body {
  font-family: Georgia, sans-serif;
}

JavaScript

var width = 600,
    height = 600,
    speed = -1e-2,
    start = Date.now();
 
var sphere = {type: "Sphere"};
 
var projection = d3.geo.orthographic()
    .scale(width / 2.1)
    .translate([width / 2, height / 2])
    .precision(.5);
 
var graticule = d3.geo.graticule();

var λ = d3.scale.linear()
    			.domain([0, width])
    			.range([-180, 180]);

var φ = d3.scale.linear()
    			.domain([0, height])
    			.range([90, -90]);
 
var canvas = d3.select("body").append("canvas")
    .attr("width", width)
    .attr("height", height);
 
var context = canvas.node().getContext("2d");
 
var path = d3.geo.path()
    .projection(projection)
    .context(context);

var land, grid;
    
function drawSphere() {
	context.clearRect(0, 0, width, height);

    context.beginPath();
    path(sphere);
    context.lineWidth = 3;
    context.strokeStyle = "black";
    context.stroke();
    context.fillStyle = "skyblue";
    context.fill();
 
    projection.clipAngle(180);
 
    context.beginPath();
    path(land);
    context.fillStyle = "wheat";
    context.fill();
 
    context.beginPath();
    path(grid);
    context.lineWidth = .5;
    context.strokeStyle = "gray";
    context.stroke();
 
    projection.clipAngle(90);
 
    context.beginPath();
    path(land);
    context.fillStyle = "lightgreen";
    context.fill();
    context.lineWidth = .5;
    context.strokeStyle = "#000";
    context.stroke();
}
 
//d3.json("https://render.github.com/mbostock/topojson/master/examples/world-110m.json", function(error, topo) {
d3.json("https://cdn.rawgit.com/mbostock/topojson/v1.6.26/examples/world-110m.json", function(error, topo) {
  land = topojson.feature(topo, topo.objects.land);
  grid = graticule();
  
  var autoRot = true, rotOff,
  	  dragStart, dragCurr, dragOff = [0,0];
      
  function addArrays(a1, a2, subtract) {
      return a1.map(function(x, i) {
          return subtract ? x - a2[i] : x + a2[i];
      });
  }
 
  //Start by having the sphere rotate slowly:
 ...