Next.js Discord

Discord Forum

firebase auth state

Unanswered
Japanese flying squid posted this in #help-forum
Open in Discord
Japanese flying squidOP
so I want to create a component with 3 states.

user is not logged in: have a cta button to login
user is logged in, but has no contacts: have a cta button to add contacts
user is logged in and has contacts: list of the contacts

I am already fetching contacts from firebase as if they are logged in, and database works fine.

Now I need to store in the state if they are logged in, and if not log them in with firebase. I assume I add NextAuth with Firebase and manage the state with Redux? Can this component be server component and still have login state? or does it have to be client? is my approach wrong?

1 Reply