8

What is alternative of .PageMode.IsExperienceEditor property of Sitecore.Context in JSS-react to verify the ExperienceEditor context ?

8

That would be isExperienceEditorActive defined in @sitecore-jss/sitecore-jss.

Usage:

import { isExperienceEditorActive } from "@sitecore-jss/sitecore-jss";

if (isExperienceEditorActive()) {
  // Do something special in the Experience Editor
}

This file also contains other very useful functions.

Credits to Corey Smith and Kam Figy who told me about this.

11

In addition to the built-in helper method, the pageState (normal, preview, editing) and pageEditing (boolean) properties are also available in the layout service context, which there are samples of in each JSS sample app:

screenshot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.