Things I Learned from the Stopwatch App

Posted on

Display

The digits are large and scale with screen width, so they never wrap on a phone.

Fixed-width numerals stop the display from jittering as digits change.

Accuracy

It reads the system clock instead of counting frames, so the time stays correct, even if the tab is throttled or in the background.

Remembered choice

The theme is saved in localStorage, and a small script in index.html applies it before the page paints, so there’s no flash of the wrong theme on reload.

Things I Learned from the Reading List App

Posted on

useState()

loadBooks is passed to useState() as a function, so it runs only once on startup instead of on every render.

useEffect()

The useEffect() in App saves the list to localStorage whenever books changes.

onUpdate and onDelete

Stars and Book are small components that receive data and callbacks as props. State lives in App, and the children just call onUpdate or onDelete.

.map() and .filter()

updateBook and deleteBook never modify the array in place. They create a new one with .map() and .filter(), which is what React needs to notice a change.