G to the Square

Geries Handal Profile picture

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

Build your own image loader hook


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.vercel.app.

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).

Copyright © 2024 Geries Handal