DEV Community 👩‍💻👨‍💻

Gokcan Degirmenci
Gokcan Degirmenci

Posted on

🌠 react-shimmer: a Better way to handle async images in React!

The Problem 😐

I needed a custom Image component to asynchronously load images in React. After experimenting with possible ideas, I wanted to apply Facebook's original placeholder effect(e.g. Shimmer) in my custom Image component. The challenge was: it also must work nicely with different image sizes and ratios.

Introducing the solution 🧠

react-shimmer is a powerful, highly customizable React <img> component that simulates a shimmer 🌠 effect while the image is loading. (with zero dependencies!).

  • Written entirely in next-gen JS.
  • Exactly zero-dependency! Only a few KBs.
  • Animation duration, delay and color options are fine-tunable.
  • Better error handling compared to default <img>.
  • Same feel of the shimmer effect on different aspect ratios and sizes.
  • (P.S. Looking for new contributors, feel free to ping me!)

GitHub logo gokcan / react-shimmer

🌠 Async loading, performant Image component for React.js


A powerful, customisable, Suspense-like <img> component that (optionally) simulates a shimmer effect while loading. (with zero dependencies!).

NPM JavaScript Style Guide Github Actions CI Status Maintainability


Live Demo


npm i react-shimmer


yarn add react-shimmer


import React from 'react'
import Image, { Shimmer } from 'react-shimmer'
function App() {
  return (
        fallback={<Shimmer width={800} height={600} />}

or you can use your custom React component as a fallback:

import React from 'react'
import Image from 'react-shimmer'

import Spinner from './Spinner'

function App(props) {
  return (
        fallback={<Spinner />}


Property Type Required Default value


  • You may also reach out to me on Twitter.

Top comments (1)

josemunoz profile image
José Muñoz

I already love it! this has been an issue for me for way too long Thanks!

Super Useful CSS Resources

A collection of 70 hand-picked, web-based tools which are actually useful.
Each will generate pure CSS without the need for JS or any external libraries.