Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated ReactDOM methods in Context Menu Singleton #7165

Open
ggdouglas opened this issue Jan 14, 2025 · 1 comment
Open

Replace deprecated ReactDOM methods in Context Menu Singleton #7165

ggdouglas opened this issue Jan 14, 2025 · 1 comment

Comments

@ggdouglas
Copy link
Contributor

ggdouglas commented Jan 14, 2025

Tracking work required for full compatibility with React 18. The imperative API methods of Context Menu Popover (showContextMenu and hideContextMenu) expose DOMMountOptions that reference deprecated ReactDOM.render and ReactDOM.unmountComponentAtNode methods as option defaults. We should replace these defaults with the current root.render(...) and root.unmount() methods. This issue is similar/related to #7166

Current support for React 18 is achieved by passing in the new ReactDOM methods as options. From the docs:

"(or ReactDOM.createRoot() if you override the default renderer via options)"

Code:

contextMenuSingleton.tsx

domRenderer = ReactDOM.render,
domUnmounter = ReactDOM.unmountComponentAtNode,

const { domUnmounter = ReactDOM.unmountComponentAtNode } = options;

References:

  1. https://react.dev/blog/2022/03/08/react-18-upgrade-guide#updates-to-client-rendering-apis
  2. Replacing render with createRoot reactwg/react-18#5
@ggdouglas ggdouglas added this to the 6.0.0 milestone Jan 14, 2025
@ggdouglas
Copy link
Contributor Author

For the initial internal React 18 upgrade, these deprecations will need to be ignored to pass the linter: #7159

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant