JSFiddle - React, Tailwind, and code Playground
HTML
<canvas id="backed-canvas" width="300" height="200"></canvas>
CSS
#backed-canvas{
background-image: url(http://www.placebear.com/300/200);
}
JavaScript
var canvas = document.getElementById('backed-canvas');
var ctx = canvas.getContext('2d');
ctx.fillStyle='red';
ctx.fillRect(20,20,100,100);
ctx.clearRect(30,30,80,80);