I want to fetch user data from firestore using onSnapshot based on cookies session id and display info about this user on web with realtime changes. But if i try to use this snapshot data in useEffect it throws a error cause useEffect()
is only available in client components and cookies().get()
is making it a server component.
Is there any way to get server side cookies because i have http only cookies for auth and then use useEffect()
with useState()
for realtime data
I read all the docs about fetching data and realtime updates using onSnapshot. I tried to use caching from nextjs but i don’t know how to make it work with firestore onSnapshot