How do I get an attribute of an element nested in a React component using Jest and/or Enzyme?

After some digging, I found the following. The indicated line in the question:

const src = img.node.props.src;

can be simplified to the following:

const src = img.prop('src');

The documentation can be found here.

If someone knows of a non-Enzyme way of doing this, I’d still be interested in hearing about it.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)