Created
February 20, 2022 17:47
-
-
Save blopa/3d12cc2a590e5b58b34a33fd05f94c4d to your computer and use it in GitHub Desktop.
Code for post "How to get the Redux State from a production build via the browser's console"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const internalRoot = Array.from(document.querySelectorAll("*[id]")).find((el) => el?._reactRootContainer?._internalRoot?.current)?._reactRootContainer?._internalRoot?.current; | |
const state = (internalRoot?.pendingProps?.store || internalRoot?.stateNode?.store || internalRoot?.memoizedState?.element?.props?.store)?.getState?.(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment