The following React error may appear in different situations, possibly when using React Testing Library:
Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.
The face value explanation
In this case the error tells the story: a component simply isn’t rendering anything. Here’s an SO post with an example.
The react-scripts
case
Described in this GH issues discussion, a problem with react-scripts
v3.4.1 was causing this error for multiple users, and downgrading to v3.4.0 solved it.
Invalid formatting
In this post, the source of the problem was the formatting of the return
statement. The opening parenthesis should be on the same line as the statement.
Wrapup
More than likely the first case applies to most people encountering the error. Components should be checked carefully to ensure that something is actually being returned and rendered.