glenjamin/skin-deep

Allow partial prop matches

Closed this issue · 4 comments

Given this element:

React.createElement(Test, {foo: true, bar: true});

Would be good to search for it with one prop:

tree.subTree('Test', {foo: true});

But currently I have to use exact:

tree.subTree('Test', {foo: true, bar: true});

Is this possible? Perhaps I'm using it incorrectly.

The method you're looking for is called subTreeLike.

As this is the more common case, in 1.0 the behaviour will change and what you've done will be correct.

Ah okay, so in 1.0 we can expect subTree and everySubTree to be the only traversal methods? I've been sticking to those two so far to avoid major refactors ahead

There will still be some way of doing exact prop matching, and i'll likely keep the Like variants around to ease migration

Cool, thanks 👍