@samitouri / QOS-React / commits / 1a6d36b1a3

Remove unmountComponentAtNode outside of legacy mode (#28650)

Ricky committed Mar 26, 2024 at 16:32 UTC 1a6d36b1a3ec43cb5700e28d7315b3aa2822365d
1 file changed +8
packages/react-dom/src/client/ReactDOMLegacy.js
+8
@@ -396,6 +396,14 @@ export function unstable_renderSubtreeIntoContainer(
396 }
397
398 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 + }
407 if (!isValidContainerLegacy(container)) {
408 throw new Error('Target container is not a DOM element.');
409 }