Loading video...

Video Failed to Load

Go Home

This is CSS performance problem I see all too often. The React website has some jank due due to their use of transition. Here is how to find what causes it and how and fix it

80,239 views • 1 year ago •via X (Twitter)

26 Comments

Dean Masley's profile picture
Dean Masley1 year ago

I cant believe I'm just seeing this. Had no idea it was so unoptimized. Feel so embarrassed for reaching for transition-all so regularly 🤦‍♂️ Never again! Thanks for sharing!

Gilbert Matos | Nodejs/Nextjs/C#'s profile picture
Gilbert Matos | Nodejs/Nextjs/C#1 year ago

It goes to show you, being able to solve all Leet code and pass interviews won't stop you from still doing this kinda stuff at work 🤣🤣🤣

Morgan Feeney's profile picture
Morgan Feeney1 year ago

Great demonstration of the problem 👏 and solution.

Mark Jaquith's profile picture
Mark Jaquith1 year ago

Great find. But why can’t the browser do this optimization under the hood? 🤔

Daniel's profile picture
Daniel1 year ago

No transition on the shadow anymore though🥴 it justs blinks on/off

crossatko's profile picture
crossatko1 year ago

Let’s pretend we didn’t see the shadow

John Urbank's profile picture
John Urbank1 year ago

I’m lazy and always go all

Zakery Kates's profile picture
Zakery Kates1 year ago

Wow. I’ve been using “all” for years not even considering the performance impact. In hindsight, it’s so obvious. Thank you.

Panta's profile picture
Panta1 year ago

Very cool! TIL browser doesn't know how to track only properties that change

simey's profile picture
simey1 year ago

Hmm... But actually the box-shadow is no longer transitioning, which looks very awkward. I am not 💯 but I don't think the "all" is the crux of the issue here and the solve was more of a side effect similar to removing the transition altogether.

Peter Cruckshank's profile picture
Peter Cruckshank1 year ago

Great video 📸 Wes is a professional jank finder 🔍

unireverse's profile picture
unireverse1 year ago

Yep always best to avoid transition all. It's definitely the box shadow that's killing it. If you wanted to keep the shadow animating, it should be in a pseudo element and transition opacity on hover

tom byrer's profile picture
tom byrer1 year ago

3x4 aspect ratio video?!? What wizardry is this!?! Thanks for the tip.

kar's profile picture
kar1 year ago

love it, thank you 😎

Ali Sherief's profile picture
Ali Sherief1 year ago

These kind of problems need to be squashed as they are found.

gńók's profile picture
gńók1 year ago

For me it's rare to "transition" anything other than the "transform" property

Harrison's profile picture
Harrison1 year ago

Probably a cursor tab for a transition property which it loves to do

Marco Fugaro's profile picture
Marco Fugaro1 year ago

bröther, the box-shadow transition was causing the lag, not what you said in the video

Udeet Mittal's profile picture
Udeet Mittal1 year ago

simple and effective!

RR's profile picture
RR1 year ago

wesbos love your tutorials, but is using no-transitions really a viable solution for React

MD NAFIUL ISLAM NOMAN's profile picture
MD NAFIUL ISLAM NOMAN1 year ago

Thanks for sharing

Himanshu Kumar's profile picture
Himanshu Kumar1 year ago

Over-reliance on transitions can indeed hinder performance, but exploring alternative animation techniques like Web Animations API might offer smoother results.

DevKasun 👨‍💻👺's profile picture
DevKasun 👨‍💻👺1 year ago

Thanks for the tip Wes!

Andile Simelane's profile picture
Andile Simelane1 year ago

I would start my poultry business

Zachary Indy's profile picture
Zachary Indy1 year ago

React = 1000% JUNK

undefined's profile picture
undefined1 year ago

I didn't expect that drop in performance; thanks for the tip. How can I show that info square in the top left corner?

Related Videos