You could avoid the dependency on the “colorList” state inside of “handleClick” by using the callback from the “setColorList” function. So “setColorList((prevState) => { …. })” and add the logic for modifying the state inside that callback and return new state. This way, when you wrap your “handleClick” function with “useCallback”, the dependency array can be empty, hence the function will stay the same and Squares that didn’t change will not rerender. Btw I really like your videos. Keep up the good work!
This was very messy, usually I really like your videos but this one was quite unstructured and jumping around the code making it difficult to follow as a viewer. At any rate, I really like your channel. Keep it up.
thank you so much for the feedback, we took note of it and we will avoid this kind of situations in the future, particularly when there's code being shared, things have to be extremely clear, again thank you so much and stay tuned for more videos :) - Dragos
"Click green"? What? In the list? What List? A list I create, even though it's the starting point? I wouldn't start until I got to clarify the requirements, and if they took offence to me basically calling their question shit, I'd leave. Interviews aren't 1 way, and this smacks of useless.
"I wouldn't start until I got to clarify the requirements" is the way to go Nick, we could have been a bit more visual and spent more time on that part of the interview, cheers
Find Your Technical Gaps With This FREE 10-Minute Technical Assessment:
learn.theseniordev.com/technical-assessment
You could avoid the dependency on the “colorList” state inside of “handleClick” by using the callback from the “setColorList” function. So “setColorList((prevState) => { …. })” and add the logic for modifying the state inside that callback and return new state. This way, when you wrap your “handleClick” function with “useCallback”, the dependency array can be empty, hence the function will stay the same and Squares that didn’t change will not rerender.
Btw I really like your videos. Keep up the good work!
This was very messy, usually I really like your videos but this one was quite unstructured and jumping around the code making it difficult to follow as a viewer. At any rate, I really like your channel. Keep it up.
thank you so much for the feedback, we took note of it and we will avoid this kind of situations in the future, particularly when there's code being shared, things have to be extremely clear, again thank you so much and stay tuned for more videos :) - Dragos
Hey folks, here is the link to the problem repository: github.com/the-senior-dev/tsd_react_live_coding_yt_version
"Click green"? What? In the list? What List? A list I create, even though it's the starting point?
I wouldn't start until I got to clarify the requirements, and if they took offence to me basically calling their question shit, I'd leave.
Interviews aren't 1 way, and this smacks of useless.
"I wouldn't start until I got to clarify the requirements" is the way to go Nick, we could have been a bit more visual and spent more time on that part of the interview, cheers