Ishan Bassi
Ishan Bassi

Reputation: 562

Difference between useSession and getSession in next-auth?

What's the difference between useSession and getSession in next-auth? Both seems to be returning session object.

Upvotes: 13

Views: 8916

Answers (1)

Chemi Adel
Chemi Adel

Reputation: 2165

useSession ReactJS hook that works only on client, that returns states which helps you to update UI and it's made on top of getSession

getSession async function that read current cookies and returns session, works both on Client and Server

Upvotes: 16

Related Questions