Skip to content
This repository has been archived by the owner on Jun 17, 2019. It is now read-only.

yormi/skin-deep-ref

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js-standard-style

skin-deep-ref

Thin skin-deep wrapper with the possibility to get a component by ref.

This is a wrapper instead of a fork to make it easy to integrate the future potential change in skin-deep.

I was using it for a few project so I thought I'll share if someone has the same need.

API

See skin-deep docs with the following humble addition:

tree.ref(ref)

ref: The ref given to the react element. Only gets the elements that would be contained in the rootOfTheTree.refs.

returns the subtree with the requested component as root.

Relevant tests

✓ returns the subtree of the requested ref at immediate level
✓ returns the subtree of the requested ref even at DOM-nested-level
✓ returns false if no element is found with the requested ref
✓ returns false if a ref owned by a child React component is requested
✓ throws an error if it find more than one ref

Credit

All the credit goes to glenjamin I just shamelessly made it fits my needs :P

About

skin-deep with the support for refs

Resources

License

Stars

Watchers

Forks

Packages

No packages published