Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access the redux store information from outside of the application. #607

Open
stephan-v opened this issue Dec 13, 2018 · 3 comments
Open

Comments

@stephan-v
Copy link

Is there any way to read the information that is currently in the redux store from outside of the application?

In react this would be possible by doing something like this before the react application is set up:

window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = {
    supportsFiber: true,

    inject: function(react) {
        console.log('inject', react);
    },

    onCommitFiberRoot: function (rendererID, root) {
        console.log('this is an initialized react app', root);
    },

    onCommitFiberUnmount: function (rendererID, fiber) {
        console.log('unmount', arguments);
    }
};

Essentially you are faking a devtools plugin which is not there and mocking up your own object with the hooks that are in the react-devtools repository.

@zalmoxisus
Copy link
Owner

We're not exposing the store object on purpose as many are using it in production. That can be easily done by just adding window.store = store in your store creator or by adding a custom store enhancer.

But there's a plan for future versions to have a button to expose it when needed, together with the actions/states history for debugging from the console.

@stephan-v
Copy link
Author

I do not have access to the store that is being created though. I am looking for a way to scrap a third party redux store.

@zalmoxisus
Copy link
Owner

zalmoxisus commented Dec 13, 2018

@stephan-v for now you can get it from Redux DevTools, just click on Provider component and it'll be in props, which can be accessed from $r. Or you can get it from Sources like here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants