Twitter | Search | |
Yomesh Gupta
Trying to write tools for humans. 💻 Engineer | ⌨️
231
Tweets
83
Following
117
Followers
Tweets
Yomesh Gupta 5h
Ya, as if the world works as per our convenience. 😏 👹
Reply Retweet Like
Yomesh Gupta 5h
*** SPOILER ALERT *** Haha! Then I will advise you to wait till next season comes out. It is a big cliffhanger in the end of this season. They should release the next season right now! 😅
Reply Retweet Like
Yomesh Gupta 5h
has just 8 episodes!! We need to know how this ends. Now. Such an intense and utterly brilliant show!
Reply Retweet Like
Yomesh Gupta retweeted
Hima MON JAI Jul 13
With the blessings of you all, once again i have won 🥇
Reply Retweet Like
Yomesh Gupta Jul 14
Reply Retweet Like
Yomesh Gupta Jul 13
Replying to @mimindo
I refactored the store a little to connect List and Item both but following a different approach which would eliminate the need for something, like shouldComponentUpdate. See this:
Reply Retweet Like
Yomesh Gupta Jul 13
Yes, that would be another way to do it. Will prevent individual renders & need for conditional rendering logic. See: Core problems' solution would be windowing & restructuring redux. You were right about the core problem being something else.
Reply Retweet Like
Yomesh Gupta Jul 12
Replying to @mimindo
Ohhh. Will try that. Thanks!
Reply Retweet Like
Yomesh Gupta Jul 12
Replying to @mimindo
Thanks for the fork. Will check it out. :D And yes, idea was to prevent re-render of individual cards or make it conditional somehow. Maybe via some custom hook or some native hooks api. I think React.memo would be the way for now.
Reply Retweet Like
Yomesh Gupta Jul 12
Yes, that would be perf optimization. It was more like the interpretation of the docs felt like, to me, it is not meant to prevent re-renders. So, wanted to get a bit clarity on it from our JS community. That's all :D
Reply Retweet Like
Yomesh Gupta Jul 12
Yes, because it is rendering a 1000 divs. Will be using windowing/infinite scroll for loading less content on the initial render. I was looking more on the lines of an equivalent to shouldComponentUpdate. I appreciate your suggestions and will implement them. Thank you :D
Reply Retweet Like
Yomesh Gupta Jul 12
I didn't yet measure the perf in production mode. I wanted to build a quick prototype as poc so chose CodeSandbox. Was looking out more in terms of an equivalent to shouldComponentUpdate.
Reply Retweet Like
Yomesh Gupta Jul 12
I think core problem is the re-rendering of all list item. Kindly check out the link in my first tweet. It has a codesandbox demo for better clarity of usecase.
Reply Retweet Like
Yomesh Gupta Jul 12
Yes, list is long and any updation with entire re-render causes browser to freeze or lag in scroll. However, shouldComponentUpdate limits re-renders and there is a perf boost. I was wondering what be the functional/hooks equivalent for that.
Reply Retweet Like
Yomesh Gupta Jul 12
[2/2] Earlier it was entire class based model but now implementing it via functions/hooks. So, I did implement via React.memo but seems confusing when docs say don't use it to prevent render. P.S. Sorry if this wasn't the right place to ask this. 😅
Reply Retweet Like
Yomesh Gupta Jul 12
[1/2] Let's say I am trying to render a large list where each item interactions can cause redux store updation which then causes the entire list to re-render. I am trying to avoid re-render for all the list items except the one with actual interaction.
Reply Retweet Like
Yomesh Gupta Jul 12
Reply Retweet Like
Yomesh Gupta Jul 12
What would be the equivalent of shouldComponentUpdate in hooks? I understand we can use React.memo for functional components but docs suggest to use it as a perf optimization rather than preventing a render. Any native counterpart? See:
Reply Retweet Like
Yomesh Gupta Jul 8
Replying to @ste_grider
And I might add that frame of reference is unintentional and implicit. After classes, hooks bring a lot of familiar concepts (state, effects, reducers) but with a different mental model altogether.
Reply Retweet Like
Yomesh Gupta Jul 8
Replying to @ste_grider
Agreed. I think when most people say that hooks are easier then unintentionally, they have a frame of reference which is class based model. Hooks, standalone, without any prior knowledge tends to bring a lot of "why this is happening moments". Classes then hooks should be the way
Reply Retweet Like