Recoilize
Recoilize copied to clipboard
TypeError: Cannot read properties of undefined (reading '_internalRoot')
React With single-spa
Uncaught TypeError: Cannot read properties of undefined (reading '_internalRoot')
with the function:
const createDevToolDataObject = (filteredSnapshot, diff) => {
if (diff === undefined) {
return {
filteredSnapshot: filteredSnapshot,
componentAtomTree: formatFiberNodes(
recoilizeRoot._reactRootContainer._internalRoot.current,
),
};
} else {
return {
filteredSnapshot: filteredSnapshot,
componentAtomTree: formatFiberNodes(
recoilizeRoot._reactRootContainer._internalRoot.current,
),
indexDiff: diff,
};
}
};
same issue with
Originally posted by @adamdaly in https://github.com/open-source-labs/Recoilize/issues/136#issuecomment-1091899426
Same problem with nextjs 12.1.6 Used https://github.com/open-source-labs/Recoilize#in-order-to-integrate-nextjs-applications-with-recoilizedebugger-follow-the-example-below
Can reproduce it. "recoilize": "^3.1.6" "next": "12.1.6",
Same for me.
React 18, custom webpack build.
Cannot read properties of undefined (reading '_internalRoot')
Has anyone found a workaround or solution for this?
React 18.1.0 NextJS 12.1.6
#172
Not sure if it's the best way
But it can work in a single React.createRoot environment
This issue happens when render is used as a standalone function instead of a method, do:
const root = createRoot(container)
root.render(<App />)
instead of:
const { render } = createRoot(container)
render(<App />)
@arthwood you, sir, are the real hero. Thanks, it worked for me!