After upgrading React to version 18 and React testing library to version 13, the error message shown as below. enter image description here
I search for custom render (https://testing-library.com/docs/react-testing-library/setup/#custom-render) with createroot but in vain.
Setting legacyRoot: true but it will be deprecated in React 18 https://github.com/testing-library/react-testing-library/releases/tag/v13.0.0