Skip to content

Commit

Permalink
Use obfusctaed reference to React.useId (#2797)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepjoy authored Sep 27, 2024
1 parent e1e307d commit 207292a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/react/id/src/id.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import { useLayoutEffect } from '@radix-ui/react-use-layout-effect';

// We `toString()` to prevent bundlers from trying to `import { useId } from 'react';`
const useReactId = (React as any)['useId'.toString()] || (() => undefined);
// We spaces with `.trim().toString()` to prevent bundlers from trying to `import { useId } from 'react';`
const useReactId = (React as any)[' useId '.trim().toString()] || (() => undefined);
let count = 0;

function useId(deterministicId?: string): string {
Expand Down

0 comments on commit 207292a

Please sign in to comment.