When I first learned to code in React, I was taught to build class components to manage state. I was told functional components were dubbed “dumb components” as they were relegated to only the most basic functionality that didn’t require state. Since then, the React devs have introduced hooks as a way to recapture the benefits of classes within functional components.

source: morioh
Notice that this useEffect has the empty array as its second argument
This effect will only run when timesPressed changes

Aspiring software engineer with almost no experience applying logic

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store