The one thing in React that matters the most...
ฝัง
- เผยแพร่เมื่อ 6 ก.ย. 2024
- Do you need to memoize components in React? What about using hooks? I talk to Oleksandr Fediashov to see if their Fluent UI v9 performance improvements came from using memoization in React.
This article by Kent C Dodds is the cause of much confusion. Don't trust everything you read without first testing yourself: epicreact.dev/...
Fluent UI's Twitter:
/ fluentui
Oleksandr Fediashov's Twitter:
/ layershifter
Kevin Ghadyani's Twitter:
/ sawtaytoes
Video Edited by **Allen Pascua**: allenfpascua.m...
Great video 👍
Example?
What kind of example are you wanting?
@@KevinGhadyani some use cases where these scenarios might play out in code bases.
You me a the scenario where memoization becomes important? I don't have any code public, but I can list some situations. Most of memoization is discussed in my talk on React hooks: th-cam.com/video/TmqxBA5j-f0/w-d-xo.html.
A lot of it comes down to the memoization cascade. When one thing is unmemoized, that affects the whole app.
On one app, it was over 1000 rerenders because you typed one letter in an input for a website designer. I had to go through and retrofit memoization where it didn't exist because someone did it wrong.
I've also worked on an image cropping tool for a stationary company. All custom, but also only smooth after memoizing. The mouse was dragging in front of the crop handles prior to memoizing everything.
Another was for a side gig. I had 300 sections of seats to display in a stadium. Memoization helped but wasn't enough in that case; I had to add concurrent rendering.
I also made a 10K number randomizer background for benchmarking libraries and without memoization, I couldn't do over 100 items. Memoization made 10K items possible.
Overall site performance is faster with memoization, but that's hard to quantify. It generally feels faster.
@@KevinGhadyani Thanks.