DEV Community

Cover image for Building a Joke guesser game in React

Posted on

Building a Joke guesser game in React

What is this post about ?

Hello fellow humanoids. Today we will build a Joke guesser game and cover some basic concepts of making API calls and other react concepts.
Check out the game here : Joke Guesser Game
Github repo for reference : Repo Link


  • How to create a game ?
  • How to use Joke API for game ?
  • How to do scoring ?

Lets go deep dive into each one and explore how it was implemented.

How to create a game

The game we are creating today will be a joke guesser game.
It will be comprised of 2 part Joke. The first part will set the premise for the joke and the gamer will enter the probable second part of the joke and will be scored according to the string similarity. The complete game is comprised of 10 rounds.
Game UI

How to use Joke API for game ?

For the game in context we would query a Joke API endpoint to fetch the joke for the round. The joke will be a bi-parted joke which we would use to form Question for the joke and use the second part for the text similarity score.

How to do scoring ?

Once the gamer has entered his guess for scoring with the original joke we would be using Text Similarity.
For text similarity we would be using "string-similarity" npm package.


This game is not developed to it's entirety and has room for improvement. Please feel free to fork the repo and make changes as you please. Do let me know if I made any grave blunders in coding this. Thanks for reading this post.
Stay safe and lend a hand to another :)

Top comments (0)