We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cd6dc93 commit fbf7b2bCopy full SHA for fbf7b2b
packages/react-form/src/useId.ts
@@ -2,12 +2,4 @@ import { version as reactVersion, useId as useReactId } from 'react'
2
import { uuid } from '@tanstack/form-core'
3
4
/** React 17 does not have the useId hook, so we use a random uuid as a fallback. */
5
-export function useId() {
6
- if (reactVersion.split('.')[0] === '17') {
7
- return uuid()
8
- }
9
-
10
- // react-compiler/react-compiler is disabled because useId is not available in React 17. However in React 18+ it is available and we want to use it.
11
- // eslint-disable-next-line react-compiler/react-compiler, react-hooks/rules-of-hooks
12
- return useReactId()
13
-}
+export const useFormId = reactVersion.split('.')[0] === '17' ? uuid : useReactId
0 commit comments