Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"useSubmit must be used within a data router" for 3rd party libraries on node 22.12.0 #12475

Open
brookslybrand opened this issue Dec 5, 2024 · 0 comments
Labels

Comments

@brookslybrand
Copy link
Contributor

brookslybrand commented Dec 5, 2024

I'm using React Router as a...

framework

Reproduction

This is the same issue as #12399 and #12401. It specifically breaks if you're using the latest version of Node 22 (22.12)

I can't use StackBlitz since it doesn't let me set the Node version, so here we go:

Use the latest node version

Note: If I use v22.9.0, I do not get this error 🙃

nvm use v22.12.0

setup a new template

npx create-react-router@latest -y

Add remix-hook-form

npm i remix-hook-form

Call useRemixForm

// home.tsx

export default function Home() {
  const form = useRemixForm({});
  return <Welcome />;
}

System Info

System:
    OS: macOS 15.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 93.73 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.12.0 - ~/.nvm/versions/node/v22.12.0/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v20.17.0/bin/yarn
    npm: 10.9.0 - ~/.nvm/versions/node/v22.12.0/bin/npm
    pnpm: 9.7.1 - ~/.nvm/versions/node/v20.17.0/bin/pnpm
    bun: 1.1.0 - ~/.bun/bin/bun
  Browsers:
    Chrome: 130.0.6723.117
    Safari: 18.1
  npmPackages:
    @react-router/dev: 7.0.2 => 7.0.2 
    @react-router/node: 7.0.2 => 7.0.2 
    @react-router/serve: 7.0.2 => 7.0.2 
    react-router: 7.0.2 => 7.0.2 
    vite: ^5.4.11 => 5.4.11

Used Package Manager

npm

Expected Behavior

It should work (see #12437 for initial fix)

Actual Behavior

It does not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant