Initial commit
This commit is contained in:
14
node_modules/use-callback-ref/dist/es2015/transformRef.js
generated
vendored
Normal file
14
node_modules/use-callback-ref/dist/es2015/transformRef.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
import { assignRef } from './assignRef';
|
||||
import { createCallbackRef } from './createRef';
|
||||
/**
|
||||
* Transforms one ref to another
|
||||
* @example
|
||||
* ```tsx
|
||||
* const ResizableWithRef = forwardRef((props, ref) =>
|
||||
* <Resizable {...props} ref={transformRef(ref, i => i ? i.resizable : null)}/>
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
export function transformRef(ref, transformer) {
|
||||
return createCallbackRef(function (value) { return assignRef(ref, transformer(value)); });
|
||||
}
|
||||
Reference in New Issue
Block a user