DEV Community

Cover image for typing-test: monkeytype clone in ReactJS
Salman Shaikh
Salman Shaikh

Posted on • Updated on

typing-test: monkeytype clone in ReactJS

Hello all,

I wanted to make a typing test website with ReactJS and JavaScript. So I looked around for good typing test website and one website came to mind monkeytype. it's quite popular for the minimal look. So I thought why not make clone of it.

After adding features and polishing the logic I thought about switching to TypeScript for experiment.

First I kept tsconfig.json settings to very loose and then tried tightening them step by step.

It was smooth three phase process (suggested by Mike North in Frontend Masters) for converting existing JavaScript codebase to TypeScript.

After 2 weeks of writing and refactoring, typing-test is ready to use for everyone.

If anyone wants to add new theme to typing-test take a look at this.
All contributions are welcomed :)

Features:

  • Colorful multiple themes support
    • default
    • mkbhd
    • coral
    • ocean
    • azure
    • forest
  • 4 time limits (15s, 30s, 45s, 60s)
  • Smooth cursor
  • Instant Tab restart
  • Previous word correction

Screenshot:

typing-test(test)

typing-test(result)

Visit Site

Source Code

Top comments (9)

Collapse
 
lexlohr profile image
Alex Lohr

I see you are still using class components. May I inquire why you haven't switched to function components and hooks?

Collapse
 
salmannotkhan profile image
Salman Shaikh • Edited

function components requires the extra hooks like useEffect and useState. I think class component is a good, clean and concise implementation of all of them. Also it code easy to write and clean to read.
EDIT: although I can convert dumb components into function components. but that's work for another day XD

Collapse
 
lexlohr profile image
Alex Lohr

Thanks for indulging my curiosity. I would probably disagree on class components being more concise than function components. Functional components require a different mental model, which does not come easy if you are used to class components.

Thread Thread
 
salmannotkhan profile image
Salman Shaikh

Yes, I agree on mental model thing. that's why I'm thinking about doing my next project with function components only. So that I can have both mental models.
About being concise it's better to have one nested state dictionary then tens of different state floating around. Function components works better when you have have 2-3 states only :)

Thread Thread
 
lexlohr profile image
Alex Lohr

If you have more/complex states, you should probably extract it and/or use useReducer to make it easier to understand.

Thread Thread
 
salmannotkhan profile image
Salman Shaikh

hmm I didn't know about that. I'll definitely look into useReducer. Thanks for suggestion :)

Collapse
 
salmannotkhan profile image
Salman Shaikh

Finally re wrote the whole app in functional approach with redux :)

Collapse
 
monkeytype profile image
Sheryl Kelsey

I learned so much from this post, thanks for sharing! I've also been exploring the Monkey Type tool, and it's proving to be a game-changer for my daily tasks.

Collapse
 
bhupender_ahlawat_bfc3566 profile image
Bhupender Ahlawat

I want to get my personal website developed for typing tutorials. Can you help me ? My Whasapp Number is +919711000010