JSFiddle - React, Tailwind, and code Playground

HTML

<canvas id="canvas"></canvas>

JavaScript

var canvas = document.getElementById("canvas"),
    ctx = canvas.getContext("2d");

canvas.width = canvas.height = 256;

ctx.save();
ctx.translate(20,20);
ctx.fillRect(0,0,10,10);
ctx.restore();
    
ctx.fillRect(0,0,10,10);