I want to connect to the existing store instance in development mode to dispatch some actions to simulate the production environment.
I tried using:
https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Methods.md#connect
but looks like it is creating a new instance every time. Is there a way to connect to existing store and dispatch an action using API?
If you want to use __REDUX_DEVTOOLS_EXTENSION__.connect()
to connect to an existing instance, you need to know and reuse its instanceId
. You can set this explicitly on the connect
options object:
const instanceA = window.__REDUX_DEVTOOLS_EXTENSION__.connect({
instanceId: 1234
});
const instanceB = window.__REDUX_DEVTOOLS_EXTENSION__.connect({
instanceId: 1234
});
While instanceA !== instanceB
, messages you .send
to instanceA
and instanceB
should still end up together in the Redux DevTools extension.