Skip to content

Commit 1a6d36b

Browse files
authored
Remove unmountComponentAtNode outside of legacy mode (#28650)
1 parent 56efb2e commit 1a6d36b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/react-dom/src/client/ReactDOMLegacy.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,14 @@ export function unstable_renderSubtreeIntoContainer(
396396
}
397397

398398
export function unmountComponentAtNode(container: Container): boolean {
399+
if (disableLegacyMode) {
400+
if (__DEV__) {
401+
console.error(
402+
'unmountComponentAtNode is no longer supported in React 18. Use root.unmount() instead.',
403+
);
404+
}
405+
throw new Error('ReactDOM: Unsupported Legacy Mode API.');
406+
}
399407
if (!isValidContainerLegacy(container)) {
400408
throw new Error('Target container is not a DOM element.');
401409
}

0 commit comments

Comments
 (0)