The best hook for arrays in React

preview_player
Показать описание
Do this if you work a lot with arrays #react #reactjs #reactjsdeveloper #programming #progammer #frontend #coding #code
Рекомендации по теме
Комментарии
Автор

q: what are you doing?
a: Notting, just hooking 😜

erkintek
Автор

You don't need to destruct when filter an array, filter is immutable and will return a new array

fabiohvp
Автор

This is great!
Just has one little problem though. Say if the data you are passing into the state is an array of nested objects. A value of an object will never be equal because object in JS is a non-primitive data type. Yet, the remove function checks for both the value and the type equivalents.
Just wanted to share!

DK-sqof
Автор

When using Array.filter to create the “remove” function, the “!==“ has limited the type of T to be primitive, which in most cases, would not be possible.

tianyili
Автор

As a Senior Dev who's been been in the industry for nearly a decade, I rate your content lad!

Kelz_v
Автор

Great video but I don't understand the types being used to define the custom you please do a video on typescript and generics 🙏
I have never gotten a hang of Generics in typescript

miraclenerdkidchiki
Автор

There’s plenty wrong with it, pass a callback instead of using the current state in your setters…

ryder