Automattic / woocommerce-payments

Accept payments via credit card. Manage transactions within WordPress.
https://wordpress.org/plugins/woocommerce-payments/
Other
174 stars 69 forks source link

Warning to use createRoot instead ReactDOM.render #7074

Open shendy-a8c opened 1 year ago

shendy-a8c commented 1 year ago

Describe the bug

When working on https://github.com/Automattic/woocommerce-payments/pull/7043, I saw this warning:

ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot

We do have ReactDOM.render() calls in the code. Even though we specify React 17 as dependency, it might be a good idea to switch to createRoot().

To Reproduce

  1. Open order edit page.
  2. See warnings in dev console.

Actual behavior

Warnings thrown:

Screenshot 2023-08-28 at 01 00 26

Expected behavior

No warning regarding ReactDOM.render.

zmaglica commented 1 year ago

@shendy-a8c I tried to reproduce an issue on my end and I can't see the error, but we do still use ReactDOM.render in our codebase, so it would be a good idea to switch tocreateRoot() as you suggested.