I don’t know if you know the game but there are a few out there on steam. One of them is called “Coloring Pixels”. I like this game a lot and I figured I want to try and implement something similar with React.
So the most basic thing I have to do for this game is, render 1000’s of pixels each one clickable. On click, it should change the selected color.
So what I thought is create a 2-dimensional array and render A x B pixels. Each pixel is for example a <div /> with an onClick event. And I’m sure this will work but I’m not sure about performance. This means the browser has to render 1000’s of pixels and attach a click listener to each of them.
So my question is, is there a better way? I looked up canvas but I think there is no way to figure out where a user clicked on it, and if so it seems to be very complicated (it only gives you x, y). Maybe there is another Package that could handle this well?
Please let me know if you got ideas to create this with good performance.
Thank you, Geralt