正在加载视频...

视频加载失败

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 次观看 • 1 年前 •via X (Twitter)

26 条评论

Dean Masley 的头像
Dean Masley1 年前

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# 的头像
Gilbert Matos | Nodejs/Nextjs/C#1 年前

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 的头像
Morgan Feeney1 年前

Great demonstration of the problem 👏 and solution.

Mark Jaquith 的头像
Mark Jaquith1 年前

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

Daniel 的头像
Daniel1 年前

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

crossatko 的头像
crossatko1 年前

Let’s pretend we didn’t see the shadow

John Urbank 的头像
John Urbank1 年前

I’m lazy and always go all

Zakery Kates 的头像
Zakery Kates1 年前

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

Panta 的头像
Panta1 年前

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

simey 的头像
simey1 年前

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 的头像
Peter Cruckshank1 年前

Great video 📸 Wes is a professional jank finder 🔍

unireverse 的头像
unireverse1 年前

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 的头像
tom byrer1 年前

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

kar 的头像
kar1 年前

love it, thank you 😎

Ali Sherief 的头像
Ali Sherief1 年前

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

gńók 的头像
gńók1 年前

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

Harrison 的头像
Harrison1 年前

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

Marco Fugaro 的头像
Marco Fugaro1 年前

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

Udeet Mittal 的头像
Udeet Mittal1 年前

simple and effective!

RR 的头像
RR1 年前

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

MD NAFIUL ISLAM NOMAN 的头像
MD NAFIUL ISLAM NOMAN1 年前

Thanks for sharing

Himanshu Kumar 的头像
Himanshu Kumar1 年前

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

DevKasun 👨‍💻👺 的头像
DevKasun 👨‍💻👺1 年前

Thanks for the tip Wes!

Andile Simelane 的头像
Andile Simelane1 年前

I would start my poultry business

Zachary Indy 的头像
Zachary Indy1 年前

React = 1000% JUNK

undefined 的头像
undefined1 年前

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

相关视频