Let's implement a generic hook for handling any kind of authorization/authentication with an abstracted model and consistent API.
Authorization on frontend can be tricky. The logic of it varies depending on what we use for authorization. Suppose you have three methods of authorization - Google, Facebook and the usual login form.
For the application it should make no difference what kind of provider it is. So we need an abstraction that will give the application all the tools to authorize with any provider.
- 1. Rendering
Creating portals with custom usePortal hook
We will change the screens with useStepper hook
Manage components appearance with useToggle hook
Removing server warnings for useLayoutEffect with custom hook
First interaction detection with useOnInteraction hook
- 2. Forms
- 3. Events
Read the scroll metadata and direction with useScroll hook
Using clipboard with useClipboard hook
Detect outside click with the useClickOutside hook
Deep dive into useIntersectionObserver hook
Element size measurement with useElementSize hook
- 4. Guards
- 5. Interactions