There are some cases in which you may want to set multiple refs on a component.
In particular, when using forwardRef or ref props, you may have a ref set by the consumer of the component in addition to an internal ref that need to be set on the same component.
Motivation
There are some cases in which you may want to set multiple refs on a component.
In particular, when using
forwardRef
or ref props, you may have a ref set by the consumer of the component in addition to an internal ref that need to be set on the same component.Solution
chainRefs
chainRefList
Testing