JSFiddle - React, Tailwind, and code Playground

JavaScript

/*************
variables to make program work
*************/
//access the canvas
var canvas = document.getElementById('myCanvas');
//access drawing environment
var context = canvas.getContext("2d");
//create a new image
var space = new Image();
space.src = "https://i.postimg.cc/DyNVWvJm/space.jpg";
//variables for rectangles

/***********
function for drawing stuff
ALL OF YOUR CODE GOES HERE vvvv
************/
function draw() {
    //color
    context.fillStyle = "pink";
    //shape
    context.fillRect(0, 0, 500, 500);
}
/************
Call the function
************/
draw(rect);
context.fillStyle = "blue";
context.fillRect(0, 0, 500,500)