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:
ENVIRONMENT
— State values will be exposed in non-production environments, but hidden in production environment. This is the default behavior.EXPOSED
— State values will be always exposed regardless of the environment.HIDDEN
— State 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
:With
StateManagerVisibility.EXPOSED
:Related items: