JSFiddle - React, Tailwind, and code Playground

by Joshua_David

HTML

<canvas id = "Canvas">

CSS

#Canvas
{
    height: 100%;
    width: 100%;
    background-color: #eee;
}

JavaScript

var Canvas = document.getElementById("Canvas");
var context = Canvas.getContext("2d");

function line(context, x1, y1, x2, y2, color) {
    context.beginPath();
    context.moveTo(x1, y1);
    context.lineTo(x2, y2);
    context.closePath();
    context.stroke();
}

line(context);