Closed
Description
react-testing-library
version: 5.5.3react
version: 15.6.2node
version: 10npm
(oryarn
) version: yarn 1.13
Relevant code or config:
import React from "react";
import { render } from "react-testing-library";
render(<div />);
What you did:
Just recently installed the library and was trying to write my first tests. Everything was working fine until I updated to 5.5.3.
What happened:
Trying to render anything in tests results in ReactDOM.render(): Invalid component element.
Reproduction:
https://codesandbox.io/s/lxzrym3p9q
Problem description:
This seems to be the culprit: https://github.com/kentcdodds/react-testing-library/blob/1d45c5c2ca1281187dc7735ac0e2f12137b157d3/src/act-compat.js#L10
Rendering null
only works in React 16, not in 15.x.
Suggested solution:
I'm actually not too sure why that line is necessary in the first place. Why is just calling ReactDOM.unstable_batchedUpdates
not enough?