G to the Square

Build your own image loader hook

2020-06-01

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

Geries Handal Profile picture

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

Copyright © 2020 Geries Handal