How to create a custom hook in ReactJS - Move your data and logic to reusable components

preview_player
Показать описание
One of the biggest benefits of React JS is being able to create reusable code - and that's where using custom hooks comes in.

Custom hooks allow you to split out your data calls and logic into components that can be used right across your whole application. From simply calling data from an API or external source, you calculating complex calculations and returning them to the front-end.

Custom Hooks act like subscriptions so the data on the front-end will only ever change when the data in the hook changes - no matter how many times you update.

00:00 - Introduction
01:18 - Creating the hook
02:30 - Importing our hook
03:55 - Subscribing to data changes
08:56 - Basic rules of hooks
10:02 - Summary

#reactjs #reacthooks #customhook
Рекомендации по теме
Комментарии
Автор

Very helpful :) thank you for that info. I was struggling how send data between 3 different components and that video help me a lot. THX again

mikez
Автор

thank you so much, this vdo defiantly help me !

niknacknutthapon
Автор

How would you type this hook with typescript? im getting the error "No overloa matches this call all over the place. Thanks and great video!

baldtepes
join shbcf.ru