JSFiddle - React, Tailwind, and code Playground

JavaScript

/*
 * Create an anchor to some inline data...
 */

var url = 'data:application/octet-stream,Testing%20one%20two%20three';
var anchor = document.createElement('a');
    anchor.setAttribute('href', url);
    anchor.setAttribute('download', 'myNote.txt');

/*
 * Click the anchor
 */

// This works in Chrome, not in Firefox
$(anchor).appendTo("body")[0].click();