Skip to content

Wrap the AsgardeoContext with a custom hook for consistency #49

@dasuni-30

Description

@dasuni-30

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;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions