I'm using rerender
and renderHook
from React-Testing-Library. Recently upgraded React version to 18 and now have below error in one of the test case.
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
rerender();
renderHook(() => abc());
Since I am not using render
why the warning is pointing rerender
and renderHook
as render
?
instead of using "@testing-library/react-hooks" use "@testing-library/react"
import { renderHook, act } from "@testing-library/react";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With