DEV Community


The Great RGB Color Game

Matthew Palmer
Ruby on Rails & JavaScript Developer JavaScript | React / Redux | Ruby on Rails | CSS | HTML
・1 min read

In a previous post earlier today, I mentioned working on The Great RGB Color Game originally by Colt Steele. I rebuilt that application in React.js, and you can see a live demo here.

This project was very fun to do, and it did a great job reminding me about using functions in stateless components. The () at the end of a function being called is so important since it executes a function. Without it, functions literally will return the entire function code itself. I also found that passing state down as props became ideal when state turned out to be so dynamic.

The app itself needed the ability to assign colors at random, but even this.setState({ }) could not seem to handle the random assignments. I ended up moving my random/assigning logic to the top level of my application so that I could pass down solid data.

If there is anything I would want my readers to know about a project like this, it should be that vanilla JS is much harder to use in a library if you're not quite sure what's initially happening. However, vanilla JS is still a powerful tool despite the default power of libraries. Never underestimate the power of your roots!

Discussion (0)

Forem Open with the Forem app