nexxtway/react-rainbow

View on GitHub
src/libs/hooks/useLabelId.js

Summary

Maintainability
A
50 mins
Test Coverage
import { useMemo } from 'react';
import useUniqueIdentifier from './useUniqueIdentifier';

export default function useLabelId(label) {
    const labelId = useUniqueIdentifier('label');
    return useMemo(() => {
        if (label) {
            return labelId;
        }
        return undefined;
    }, [labelId, label]);
}