mercredi 25 mars 2020

Find second to last child with Enzyme

How to look for the second to last child node returned by the find() method of Enzyme? The last child could be found with .last(), but the one before that?

I know it doesn't return an array, but what I would expect to do is something like:

const elementsArray = wrapper.find('element');
const secondToLastElement = elementsArray.at(elementsArray.length - 1);

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire