React 18 Tutorial - UseCallback Hook

preview_player
Показать описание
React 18 Tutorial
Episode 118 - UseCallback Hook

Entire Playlist

Source Code
Рекомендации по теме
Комментарии
Автор

useCallback uses a dependency of [people] to update the state as all the data has been erased from UI portion but in console 1 array item left showing in it

munavarsheik
Автор

instead of passing 'people' as a dependency, we can just write removePerson function's body as the following setPeople(prev=> prev.filter(person => person.id !== id));

CartoonDi
Автор

Hello Johh, thanks for your awesome coding content.
But I have a question, how to handle this in the context provider? There are a bunch of functions passed to all children components in the app. Are they prone to re-rendering issues? or because of the useContext hook this would not be an issue, and it's only handled when doing prop drilling.

nicolascalderon