21 November 2021
React CanvasComponent and Conway’s Game of Life
A few years ago, I was messing around with the HTML Canvas element and 2d rendering context in React and I came up with a very simple component that would let me run a
draw function whenever the props updated. Here’s the code on codepen.
For good measure, I included a simple demo implementation of Conway’s Game of Life (which is a zero-player game, so don’t expect to be able to do anything after clicking start):