The simplest solution, unfortunately, is to modify the source code to set a global variable to the Redux store. (It may be worth preemptively modifying any applications you can control to do this, just to make Safari easier to debug.)
Without modifying the source code, it should be possible, although it's awkward. The following instructions work for React 16.12.0.
- In Safari's Web Inspector (dev tools), go to the Elements tab and find your React root element (the
<div id="root">
or similar that you pass to ReactDOM.render
).
- Click on it. Web Inspector should show a
= $0
next to it, indicating that you can now reference that DOM node in the Web Inspector console as $0
.
- In the Web Inspector's Console tab, type
Object.keys($0)
and press Enter to see the internal properties that React adds to the DOM node. For my app, I see ["__reactContainere$8yexuoe6iiv", "_reactRootContainer"]
.
- Dump the internal React object to the console by typing
$0["__reactContainere$8yexuoe6iiv"]
(substituting your internal property name) and pressing Enter.
- Inspect the object properties to find the Redux store: on my app, it's under
child
, under memoizedProps
, under store
, but this may depend on the specifics of your React component hierarchy and where and how you mount Redux's <Provider>
.
- Use the
store
reference you just found to call Redux's getState. For my app, that means typing $0["__reactContainere$8yexuoe6iiv"].child.memoizedProps.store.getState()
and pressing Enter.
A simpler one-line alternative to the above:
document.getElementById('root')['_reactRootContainer']._internalRoot.current.child.memoizedProps.store.getState()