Skip to content

Commit

Permalink
Merge branch 'main' into fix/combobutton-imports
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Jul 7, 2023
2 parents c6c676c + d594e9b commit 100c989
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions packages/react/src/internal/useId.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@
// the new hook and call the `nativeReactUseid` function, but if the user is
// running a version older than React 18 we will keep using our old hook.

import {
useEffect,
useLayoutEffect,
useState,
useId as reactUseId,
} from 'react';
import React, { useEffect, useLayoutEffect, useState } from 'react';
import setupGetInstanceId from '../tools/setupGetInstanceId';
import { canUseDOM } from './environment';
import { useIdPrefix } from './useIdPrefix';
Expand Down Expand Up @@ -70,7 +65,7 @@ export function useId(prefix = 'id') {
}
}, []);

if (reactUseId) {
if (typeof React['useId'] === 'function') {
const id = nativeReactUseId(_prefix, prefix);
return id;
}
Expand All @@ -79,7 +74,7 @@ export function useId(prefix = 'id') {
}

function nativeReactUseId(_prefix, prefix) {
const getId = reactUseId();
const getId = React['useId']();

const id = `${_prefix ? `${_prefix}-` : ``}${prefix}-${getId}`;

Expand Down

0 comments on commit 100c989

Please sign in to comment.