Skip to content

useAdminContext

const useAdminContext = (): types.IReadAdminContext

Hook with no arguments to access some useful values from the AdminContext. It returns an object.

Example usage

const { isAdmin, previewMode } = useAdminContext()

AdminContext

The AdminContext provides the context needed by the admin editing interface.

The useAdminContext returned object has the following interface

interface IReadAdminContext {
isAdmin: boolean
previewMode: boolean
}
  • isAdmin is true in the Admin interface and false on the public front-end.
  • previewMode is true when the Full-screen preview is active in the Admin interface and false otherwise.

The <Admin> component wraps all the children with the AdminContext Provider.