G to the Square

Build your own image loader hook

June 01, 2020

In the spirit of learning and having fewer dependencies, I decided to explore the creation of a “simple” image loader react hook. The hook will enable you to trigger loading of images and get different states to show a loader, handle timeouts and errors.

Like most things in frontend development, it started from being a simple blog post and ended up becoming a whole site with demos, explanations and code. You can check the end result at: https://the-image-loader-react-hook.now.sh/.

The menu has a go through as well as demos with usage. It also, includes a server (code not shown) to simulate delay in image loading. The site is built with next.js and hosted in Vercel (before Zeit Now).

Occasionally, I write my opinions on software development. By Geries Handal. Github, Gitlab