/react-hooks-interval

React Hooks: Interval

Primary LanguageJavaScript

Problem

React Hooks, unlike Class Components, provide low-level building blocks for optimizing and composing applications with minimal boilerplate.

Without in-depth knowledge, performance problems can arise and code complexity can increase due to subtle bugs and leaky abstractions.

Case Study: Implementing Interval

This 12 part case study is trying to demonstrate common problems using React Hooks and ways to fix them.

The goal is to implement counter that starts from 0 and increases every 500ms. Three control buttons should be provided: start, stop and clear.

Getting Started

> npm install

> npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

Gotchas

Application is intended to crash in some examples due to memory leaks, infinite recursion, starvation or other bugs. Purpose of this demo is to show common pitfalls with React Hooks and how to avoid them.