Skip to main content

Hiding values from React Developer Tools

By default, useStateValue and useStateValueWithReactiveSelector only exposes the state value to the React Developer Tools in non-production environments and hides it in production environment.

The state value is obscured by storing it inside a WeakMap and conditionally exposed as "InspectableValue" instead.

This behavior can be changed via the visibility option, which has three modes:

  • ENVIRONMENTState values will be exposed in non-production environments, but hidden in production environment. This is the default behavior.
  • EXPOSEDState values will be always exposed regardless of the environment.
  • HIDDENState values will be always hidden regardless of the environment.

The screenshots below show how State Managers with different visibility values appear in the React Developer Tools.

With StateManagerVisibility.HIDDEN:Inspecting an exposed state in React Dev ToolsInspecting an exposed state in React Dev Tools
With StateManagerVisibility.EXPOSED:Inspecting a hidden state in React Dev ToolsInspecting a hidden state in React Dev Tools


Related items: