based on this video https://www.youtube.com/watch?v=14B85quRQhw at min 26:02

if you return from your context :
const authProviderValue = {
sessionExpired,
authenticated,
user,
token,
initiateLogin,
handleAuthentication: handleIncomingPayload,
logout,
};
return <AuthProvider value={authProviderValue}>{children}</AuthProvider>;
const authProviderValue = {
sessionExpired,
authenticated,
user,
token,
initiateLogin,
handleAuthentication: handleIncomingPayload,
logout,
};
return <AuthProvider value={authProviderValue}>{children}</AuthProvider>;
and from this context i use just what ii need... is a good Approach ? yes, i have like :
export default () => {
const context = React.useContext(authContext);

if (context === undefined) {
throw new Error('authContext is undefined');
}
return context;
};
export default () => {
const context = React.useContext(authContext);

if (context === undefined) {
throw new Error('authContext is undefined');
}
return context;
};
Still does to many re-renders or solve the problem that is in video ?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server