A custom hook is a function whose name starts with use and that calls other hooks to package and reuse stateful logic — without changing your component tree (unlike HOCs or render props).
jsx
() {
[data, setData] = ();
[loading, setLoading] = ();
[error, setError] = ();
( {
ctrl = ();
();
(url, { : ctrl. })
.( r.())
.(setData)
.( { (e. !== ) (e); })
.( ());
ctrl.();
}, [url]);
{ data, loading, error };
}
() {
{ data, loading, error } = ();
(loading) ;
;
}
