JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<canvas id='canvas'></canvas>
<a id='a'>click me to save</a>

JavaScript

$('#a').click(save);

function save(ev) {
  $('#canvas')[0].toBlob((blob) => {
    //jquery let me down.  only way i can get this to work is vanilla js -_-
    let URLObj = window.URL || window.webkitURL;
    let a = document.createElement("a");  
    a.href = URLObj.createObjectURL(blob);
    a.download = "untitled.png";
    document.body.appendChild(a);
    a.click();
    document.body.removeChild(a);
  });
}