How you can use custom hooks to abstract your react code

preview_player
Показать описание
abstracting your react code into custom react hooks can help you keep a maintainable project.

------------

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

This is exactly how i started writing my react applications...
It really makes your code cleaner

johnobiofiong
Автор

Ever since I learned react and Nextjs, I've started to use that approach. I find it to be a great way to design your web application

theprimecoder
Автор

Great. I would love to see how you abstract even further the pagination with a hook`usePagination`. I have seen myself using that pattern before where I return page,

darkzennn
Автор

This is much cleaner and it also allows you to unit test the hook - yes you will have more files to manage but you at least get like you say, a decoupled entity

astb
Автор

thanks for the video

what's your vscode theme name?

sergeismirnov
Автор

the only custom hook I used is a useAuth hook to check if the user is authenticated, and if he has the correct role to access certain routes/actions.

reaper_
Автор

what extension is he using to have lintin in js files like at 2:53?

pluvio
Автор

Hello, what extension are you using to show warnings in the code at 2:31?

bonuocdua
Автор

I do something similar for some of my code for calls to CMSes....

DanteMishima
Автор

How would you handle multiple api calls that depend on each other? Just curious

Aadityaad
Автор

to make your code step up to the next level you could finally use typescript

Keinjojo
Автор

Just moving the problem to another file. It won't help from refactoring.

krlprmy