Using ReactJS on itch.io

Despite clearly not being a game engine, ReactJS has a lot of potential for being used to create simple HTML based games - in fact, one of the first use cases React introduces to you in its tutorials is using the React framework to create Tic Tac Toe.

So say you want to build a game in ReactJS and upload it to itch.io. If you started your project by running npx create-react-app, then ran npm run build, zipped up the folder, then uploaded it to itch.io, you will see a result of something like this:

An itch.io draft game page.
The game is just blank. Despite it working when you ran the React project locally, with npm start, it does not work on itch.io.

So how do you fix this? The solution is, thankfully, quite simple. Go into your package.json and add the following line after the version number:

"homepage": ".",

Then simply rebuild the project, upload it, and the results should be as follows:

An itch.io draft game page.
Hooray! The default create-react-app page is showing as expected!

Hopefully this has helped you if this was a problem you encountered.

ReactJS is certainly far from being a common framework used for online games, but there are a fair few examples of great React games to be found on itch.io. Here are a few I liked:

  • hacker-forest - great puzzle game with simulacra of hacking into a website.
  • Turkey Hunt - classic arcade hunting game.
  • doop - really well polished puzzle game about rotating layers.
  • Happy Mice - curious little simulator of mice life and death.
  • Minesweeper Clone - very clean minesweeper clone.
  • Valyrian Wordle - a Wordle clone, but in High Valyrian, a language of Game of Thrones.