mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-23 00:45:16 +00:00
22 lines
803 B
JavaScript
22 lines
803 B
JavaScript
import React from 'react';
|
|
export default function forwardRef(renderFn, _temp) {
|
|
var _ref = _temp === void 0 ? {} : _temp,
|
|
propTypes = _ref.propTypes,
|
|
defaultProps = _ref.defaultProps,
|
|
_ref$allowFallback = _ref.allowFallback,
|
|
allowFallback = _ref$allowFallback === void 0 ? false : _ref$allowFallback,
|
|
_ref$displayName = _ref.displayName,
|
|
displayName = _ref$displayName === void 0 ? renderFn.name || renderFn.displayName : _ref$displayName;
|
|
|
|
var render = function render(props, ref) {
|
|
return renderFn(props, ref);
|
|
};
|
|
|
|
return Object.assign(React.forwardRef || !allowFallback ? React.forwardRef(render) : function (props) {
|
|
return render(props, null);
|
|
}, {
|
|
displayName: displayName,
|
|
propTypes: propTypes,
|
|
defaultProps: defaultProps
|
|
});
|
|
} |