Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blopa/3d12cc2a590e5b58b34a33fd05f94c4d to your computer and use it in GitHub Desktop.
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"
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