DEV Community

Discussion on: 22 Miraculous Tools for React Developers in 2019

Collapse
 
iam_danieljohns profile image
Daniel Johns

I find the bit about react-testing-library confusing, could you explain that a bit more?

Collapse
 
jsmanifest profile image
jsmanifest • Edited

Hi Daniel,

The way react-testing-library works is that you query for actual DOM nodes. You query the DOM in the same way the user would see in their screen. For example some of the ways you select a DOM node is by label text, element text, the native document.querySelector api, element id, etc. A popular alternative before react-testing-library was introduced into the scene was Enzyme. But enzyme worked with instances of rendered React components. Working with instances is closer to implementation details as opposed to working with actual DOM nodes.