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

2 Answers 2


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


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.

  • The isExperienceEditorActive() function was removed somewhere in 2021. It was replaced by the isEditorActive() function. Mar 25 at 15:57

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:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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