Check out example codes for "canvas html". It will help you in understanding the concepts better.

Code Example 1

<canvas id="myCanvas" width="200" height="100"></canvas>

Code Example 2

#this code creates a circle within a canvas that must be created in HTML
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.arc(95, 50, 40, 0, 2 * Math.PI);
ctx.stroke();

Code Example 3

var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");

 ctx.moveTo(0, 0);
ctx.lineTo(200, 100);

 ctx.stroke();

Learn ReactJs, React Native from akashmittal.com