You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting the React 18 createRoot warning when using renderHook. I've updated my app to react 18 already and have the latest testing library installed. Does anyone know the solution to this?
Results in console.error
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
The text was updated successfully, but these errors were encountered:
The RTL PR has been merged now, so if you’ve updated your app and other tests to React 18, you should be ready to migrate your renderHook imports to @testing-library/react now too.
I am still getting the warning An update to TestComponent inside a test was not wrapped in act(...)
I tried wrapping renderHook inside an act but in TypeScript I get following error:
lethook: RenderHookResult<any,any>;act(()=>{hook=renderHook(myHook);});const{ result }=hook;// Here I get typescript error saying: "Trying to use variable before it's assigned"
The RTL PR has been merged now, so if you’ve updated your app and other tests to React 18, you should be ready to migrate your renderHook imports to @testing-library/react now too.
Yeah, I changed import { renderHook, act } from '@testing-library/react-hooks';
to import { renderHook, act } from '@testing-library/react';
and the error disappeared
I'm getting the React 18 createRoot warning when using renderHook. I've updated my app to react 18 already and have the latest testing library installed. Does anyone know the solution to this?
The text was updated successfully, but these errors were encountered: