Skip to content

TypeError: useId is not a function - @tanstack/react-form not compatible with React 17 anymore #1829

@filoupegase

Description

@filoupegase

Describe the bug

TanStack Form declares support for React 17 in its peer dependencies, but now uses useId() which is only available in React 18+.
This causes a runtime error when using the library with React 17.

Error Message

TypeError: (0 , import_react3.useId) is not a function

OR
export 'useId' (imported as 'useId') was not found in 'react'

Environment
@tanstack/react-form: 1.23.8
react: 17.x
react-dom: 17.x

Your minimal, reproducible example

/

Steps to reproduce

Install @tanstack/react-form in a React 17 project
Use useForm() hook in a component
Run the application
Error occurs because useId is not defined was not found in react

Expected behavior

Either:

  • The library should work with React 17 as declared in peer dependencies
  • Or the peer dependencies should be updated to require React 18+

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

OS: [macOS]
Browser: [Chrome]

TanStack Form adapter

None

TanStack Form version

1.23.8

TypeScript version

5.9.2

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions