Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap the AsgardeoContext with a custom hook for consistency #49

Open
dasuni-30 opened this issue Jul 29, 2024 · 0 comments
Open

Wrap the AsgardeoContext with a custom hook for consistency #49

dasuni-30 opened this issue Jul 29, 2024 · 0 comments

Comments

@dasuni-30
Copy link
Contributor

Description:

Currently we directly access the context and it is better to access the context via a hook. Wrap the AsgardeoContext with a custom hook (ex: useAsgardeo)

const useBrandingPreference = (): UseBrandingPreferenceInterface => {
    const context: BrandingPreferenceContextProps = useContext(BrandingPreferenceContext);

    if (context === undefined) {
        throw new Error("UseBrandingPreference must be used within a BrandingPreferenceProvider");
    }

    return context;
};

export default useBrandingPreference;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant