Search code examples
next.jsnext-auth

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.


Solution

  • 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