ディープブルー (deepblue)
DTDrizzle Team
•Created by ディープブルー (deepblue) on 9/20/2024 in #help
Neon can use client component, but not local postgres? - next14,postgres,drizzle -
Hi,
how to re-create this use-effect using a server component?
useEffect(() => {
const fetchNotifications = async () => {
if (email) {
const user = await getUserByEmail(email);
if (user) {
const unreadNotifications = await getUnreadNotifications(user.id);
setNotifications(unreadNotifications);
}
}
};
fetchNotifications();
const notificationInterval = setInterval(fetchNotifications, 30000); // Poll every 30 seconds
return () => clearInterval(notificationInterval);
}, [email]);
thanks.
7 replies