[JS] How I Fixed React’s Annoying Load Flickers

[JS] How I Fixed React’s Annoying Load Flickers

Hey 👋 お元気ですか?

What You Can Expect from This Post

You ever load up your React app — and for a split second, everything’s just... blank? Or worse, elements pop in one by one — the background loads, then the avatar, then the UI buttons, and it feels like your app is building itself in front of the user?

Yeah. That’s load flicker, and it’s a silent killer of smooth UX.

Today I want to share how I fixed this in my React game project.


The Problem I Had

In my small React game, I had a custom background image and some character images. The game itself worked perfectly. But every time I refreshed the page or opened the app:

  • The screen would flash white for a moment
  • Then background image popped in
  • Then my UI finally settled

It wasn’t broken, but it was ugly.


What's Causing the Flash?

React renders components fast — but your assets (images, fonts, animations) still need time to download. If those aren't cached or loaded properly, you’ll see a visual flash before everything’s ready.


I Tried to Fix This In Below Ways

Compress Large Images

The first thing I realized — my images were way too big.

I had PNGs that were 1MB+ (🙈 oops). That means even on fast internet, they took time to render. I compressed them to around ~100KB each without losing quality. Now the browser could load them much faster.

Preload Critical Assets

Preload tells the browser:

"Hey, I'm going to need this image really soon — start loading it now."

You can do this in your HTML:

<link rel="preload" as="image" href="/images/background.jpg" />

In my React app, I added a preload for the background image and key UI icons inside public/index.html. The difference was immediate — background loaded with the UI, no more lag.

Host Images on Cloudinary

At first, I stored all my images inside the React project folder (/public/images). But I quickly realized — every time I deployed, those large files slowed things down.

So I moved them to Cloudinary, a cloud-based media management platform. Here’s why that helped:

  • It automatically compresses and optimizes images
  • It serves images via a global CDN
  • It gives you a fast, shareable URL to use directly in your app

You can even tell Cloudinary to auto-optimize the image with the f_auto (format) and q_auto (quality) parameters:

<https://res.cloudinary.com/your-cloud-name/image/upload/f_auto,q_auto/v1713859301/background.jpg>

This lets Cloudinary choose the best format (like WebP or AVIF) and quality based on the user’s device — automatically.


Conclusion

That little flicker may not crash your app, but it breaks your user’s focus — and their trust in your experience. So next time you build or ship a React app, you can try:

  • Compress your assets
  • Import photos from Cloudinary
  • Preload what is

…and your UI will feel snappy, smooth, and solid.

じゃ、またね!