3d-tiles-renderer
Version:
https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification
28 lines (14 loc) • 323 B
JavaScript
import { useCallback } from 'react';
export function useMultipleRefs( ...refs ) {
return useCallback( target => {
refs.forEach( ref => {
if ( ref ) {
if ( typeof ref === 'function' ) {
ref( target );
} else {
ref.current = target;
}
}
} );
}, refs ); // eslint-disable-line
}