In terms of performance which one would be better whether to use multiple useEffect for different dependencies or merge them all like this?
useEffect(() => {
if (user) {
showNotification({
title: "Welcome",
message: "You have successfully logged in! 😊",
});
}
if (loading) {
return <Loading />;
}
if (error) {
switch (error?.code) {
case "auth/popup-closed-by-user":
showNotification({
color: "red",
title: `Opps!`,
message:
"You closed the popup window, please try again",
});
break;
default:
showNotification({
color: "red",
title: `Opps!`,
message: "Something went wrong",
});
}
}
}, [user, error, loading]);