Name useEffect functions to clarify intent
In React, you can use named functions instead of arrow function as parameter in useEffect to clarify intent and facilitate determine behaviour.
// Avoid
useEffect(() => {
// do stuff
}, []);
// Prefer. Intent documented.
useEffect(function connectUserToChat() {
// stuff
return () => {
// cleanup
};
}, []);
}
From: Name useEffect functions