React useState array update not updating the UI fix, implementation of react array state #Shorts

preview_player
Показать описание
The fix of the problem react useState array item, when we put array item in react state and try to change its value and set the new value to react state using set function, the UI doesn't get updated because react doesn't detect any change in the given array ( it's an array reference related issue). But when we use the method of assignment like [...array] the problem get fixed, probably because the list gets a new refrence.
Рекомендации по теме
Комментарии
Автор

I struggled with that f.. problem for about a day. Thanks man!

fouailler
Автор

I have been wrestling with this issue for a while now and your video helped hugely. Thank you 😊

MoonSkanker
Автор

watching this made me think of a different way to solve my problem so it helped even tho the solution in the video didn't help

creativeyes
Автор

tq man...really help me, been troubleshooting for 5 hours already

ahmadsaifullah
Автор

wt f, idk what its happened with the code, but alredy its working!! ty a lot

SergieArizandieta
Автор

don't use the splice method as it mutates the original array, use filter

Artur-pksw
Автор

Dont mutate the state variable directly

vaishnavr