NextAuth/4/UseSession Array To Object Destructuring

/icons/calendar.svg

Last update

Aug 21, 2024

The useSession hook has been updated to return an object. This allows you to test states much more cleanly with the new status option.

Before

const [session, loading] = useSession();

After

const { data: session, status } = useSession();
const loading = status === 'loading';

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now