Replies: 1 comment 1 reply
-
use useEffect to write the current session state to the store somewhere at
the root of your app / page?
…On Tue, Apr 13, 2021 at 9:07 AM Kirill Tolkachev ***@***.***> wrote:
Hi, i'm using next-auth project for authentication. Also i love mobx :)
Sometimes this combination confusing me, because i really want use
authenticated username in mobx store, but this information provided by
next-auth react hook useSession().
Typical page code:
export const Page = () => {
const [session, loading] = useSession();
const store = useMyStore();
return <div>
{session.user.email}
{store.user.email}
</div>}
What is the best for way combine useSession and mobx store?
Advantages of migrating session to Mobx:
1. Use session anywhere in my app
2. Reactive handling UI changes when user authenticating (Change
controls and other)
3. Avoiding information duplication
4. Binding some actions to authenticating data
Thanks all :)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2892>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBEBYHPUNF5C4ISIDG3TIP3V3ANCNFSM4222MWXA>
.
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, i'm using next-auth project for authentication. Also i love mobx :)
Sometimes this combination confusing me, because i really want use authenticated username in mobx store, but this information provided by next-auth react hook
useSession()
.Typical page code:
What is the best for way combine useSession and mobx store?
Advantages of migrating session to Mobx:
Thanks all :)
Beta Was this translation helpful? Give feedback.
All reactions