Next.js Discord

Discord Forum

Proper way to revalidate a client component?

Answered
Bighead carp posted this in #help-forum
Open in Discord
Bighead carpOP
I have a client component which renders the button on the right. I'm using a server action to get the amount of 'credits' left, then when the popup is closed, I call the same server action to get the new number. I wonder if this is the best way?

2 Replies

Fieldfare
I wouldn’t even use a useEffect for that, rather just directly assign it to a useState when it’s fetched
Answer