@navikt/ds-react
Version:
React components from the Norwegian Labour and Welfare Administration.
14 lines • 416 B
JavaScript
/**
* If the provided argument is a ref object, returns its `current` value.
* Otherwise, returns the argument itself.
*
* Non-generic to safely handle refs whose `.current` may be `null`.
*/
function resolveRef(maybeRef) {
if (maybeRef === null) {
return maybeRef;
}
return "current" in maybeRef ? maybeRef.current : maybeRef;
}
export { resolveRef };
//# sourceMappingURL=resolveRef.js.map