Skip to content

Instantly share code, notes, and snippets.

@yorickvP
Created July 24, 2019 17:04
Show Gist options
  • Save yorickvP/ba7ebf5a84482d52506ff52c7bc50bae to your computer and use it in GitHub Desktop.
Save yorickvP/ba7ebf5a84482d52506ff52c7bc50bae to your computer and use it in GitHub Desktop.
(function() {
'use strict';
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = {
checkDCE: function() {},
supportsFiber: true,
roots: new Set(),
inject() {},
onCommitFiberRoot(rendererID, root) {
const current = root.current;
if (current.memoizedState != null && current.memoizedState.element != null) {
if (!this.roots.has(root)) {
this.roots.add(root);
console.log("got react!")
}
} else {
this.roots.delete(root)
}
},
get state() {
return Array.from(this.roots)[0].current.memoizedState.element.props.store.getState()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment