-
Notifications
You must be signed in to change notification settings - Fork 233
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
Warning: ReactDOM.render is no longer supported in React 18. #832
Labels
question
Further information is requested
Comments
Oh, am I just a little too late to the party: https://github.com/testing-library/react-hooks-testing-library#a-note-about-react-18-support and also this? |
My bad. Evidently, I was just not aware of the change: https://testing-library.com/docs/react-testing-library/api/#renderhook. testing-library/react-testing-library#991 (comment) import { renderHook } from '@testing-library/react' // <-- NOW
test('returns logged in user', () => {
const { result } = renderHook(() => useLoggedInUser())
expect(result.current).toEqual({ name: 'Alice' })
}) |
4 tasks
taliesins
added a commit
to taliesins/backstage-showcase
that referenced
this issue
Mar 19, 2024
taliesins
added a commit
to taliesins/backstage-showcase
that referenced
this issue
Mar 27, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is your question:
Is there a way to remove the
Warning: ReactDOM.render is no longer supported in React 18.
warning from@testing-library/react-hooks -> renderHook
?Related PRs:
As suggested in some blog posts and some GitHub issues, I upgraded react-testing library to support React 18 createRoot:
But I keep getting this warning:
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
When I do:
The screenshot below shows a barebones test using
@testing-library/react-hooks
without any gimmicks and it throws a warning.Notice that I do not get this warning when using
@testing-library/react
. The screenshot below shows a barebones component that uses a hook and doesn't throw a warning.The text was updated successfully, but these errors were encountered: