File tree Expand file tree Collapse file tree
packages/react/src/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828// the new hook and call the `nativeReactUseid` function, but if the user is
2929// running a version older than React 18 we will keep using our old hook.
3030
31- import {
32- useEffect ,
33- useLayoutEffect ,
34- useState ,
35- useId as reactUseId ,
36- } from 'react' ;
31+ import React , { useEffect , useLayoutEffect , useState } from 'react' ;
3732import setupGetInstanceId from '../tools/setupGetInstanceId' ;
3833import { canUseDOM } from './environment' ;
3934import { useIdPrefix } from './useIdPrefix' ;
@@ -70,7 +65,7 @@ export function useId(prefix = 'id') {
7065 }
7166 } , [ ] ) ;
7267
73- if ( reactUseId ) {
68+ if ( typeof React [ 'useId' ] === 'function' ) {
7469 const id = nativeReactUseId ( _prefix , prefix ) ;
7570 return id ;
7671 }
@@ -79,7 +74,7 @@ export function useId(prefix = 'id') {
7974}
8075
8176function nativeReactUseId ( _prefix , prefix ) {
82- const getId = reactUseId ( ) ;
77+ const getId = React [ 'useId' ] ( ) ;
8378
8479 const id = `${ _prefix ? `${ _prefix } -` : `` } ${ prefix } -${ getId } ` ;
8580
You can’t perform that action at this time.
0 commit comments