Redux Domain
The Redux domain is a custom CDP domain for tracking Redux state changes and actions in React Native apps.
Overview
The Redux domain provides integration with Redux DevTools Extension for debugging Redux applications. Redux actions and state changes are sent as CDP messages and can be viewed in the Redux panel in DevTools.
Methods
Redux.message
Sends a Redux message from the application to DevTools or vice versa. This is the unified method that handles all Redux message types. Matches Redux DevTools Extension message format exactly.
Parameters:
type(MessageType): Message typeINIT_INSTANCE: Redux instance initializationINIT: Store initializationACTION: Action dispatchSTATE: State updateERROR: Error occurred
action(string, optional): Action payload (JSON string, for ACTION type)payload(string, optional): State payload (JSON string, for INIT and ACTION types)source(string): Source of the message (e.g., "@devtools-page", "@devtools-extension")instanceId(string): Instance ID of the Redux storename(string, optional): Store name (for INIT type)maxAge(integer, optional): Maximum age of actions to keep (for ACTION type)nextActionId(integer, optional): Next action ID (for ACTION type)error(string, optional): Error message (for ERROR type)timestamp(Runtime.Timestamp, optional): Timestamp when the message was created
Events
Redux.message
Emitted when a Redux message is received from the application. Matches Redux DevTools Extension message format exactly.
Parameters:
type(MessageType): Message typeaction(string, optional): Action payload (JSON string, for ACTION type)payload(string, optional): State payload (JSON string, for INIT and ACTION types)source(string): Source of the messageinstanceId(string): Instance ID of the Redux storename(string, optional): Store name (for INIT type)maxAge(integer, optional): Maximum age of actions to keep (for ACTION type)nextActionId(integer, optional): Next action ID (for ACTION type)error(string, optional): Error message (for ERROR type)timestamp(Runtime.Timestamp, optional): Timestamp when the message was created
Usage
React Native
To use Redux DevTools in a React Native app:
Zustand
To use with Zustand:
Metro Configuration
You need to add Redux DevTools Extension polyfill to your Metro configuration:
Message Types
INIT_INSTANCE
Sent when a new Redux instance is initialized. Notifies DevTools of a new store instance.
INIT
Sent when a store is initialized. Includes initial state and store metadata.
ACTION
Sent when an action is dispatched. Includes action type and payload.
STATE
Sent when state changes. Includes the new state.
ERROR
Sent when an error occurs. Includes error message.
Notes
- The Redux domain is a React Native-only custom CDP domain.
- Fully compatible with Redux DevTools Extension format.
- Can track multiple Redux store instances simultaneously.
__REDUX_DEVTOOLS_EXTENSION__is automatically injected for compatibility with Redux DevTools Extension API.