Skip to content

Commit 671fac2

Browse files
NickyMeulemanKent C. Dodds
authored andcommitted
docs: add React.Fragment info (testing-library#98)
* docs: add React.Fragment info When rendering a component that has a `React.Fragment` as the root element. `container.firstChild` will only grab the first child of the fragment, NOT the fragment JSX-tag * Update README.md
1 parent 46e6c41 commit 671fac2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ The containing DOM node of your rendered React Element (rendered using
165165
`container.querySelector` etc. to inspect the children.
166166

167167
> Tip: To get the root element of your rendered element, use `container.firstChild`.
168+
>
169+
> NOTE: When that root element is a
170+
> [React Fragment](https://reactjs.org/docs/fragments.html), `container.firstChild`
171+
> will only get the first child of that Fragment, not the Fragment itself.
168172
169173
#### `debug`
170174

0 commit comments

Comments
 (0)