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
istrue
in the Admin dashboard andfalse
on the public front-end.previewMode
istrue
when the Full-screen preview is active in the Admin dashboard andfalse
otherwise.
The <Admin>
component wraps all the children with the AdminContext Provider.