next-auth 中 useSession 和 getSession 的区别?

useSession 中的 getSessionnext-auth 有什么区别?两者似乎都返回 session 对象。

stack overflow Difference between useSession and getSession in next-auth?
author avatar


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