path.split is not a function

See original GitHub issue

Describe the bug Follow the initial Get Started documentation, install on a new Create Next App. Adding an input with ref={register} produces blocking error.

To Reproduce Steps to reproduce the behavior:

  1. Create Next App
  2. npm install react-hook-form
  3. Copy example block
  4. Unhandled Runtime Error / TypeError: path.split is not a function

Codesandbox link (Required) Occurs on default CodeSandbox: https://codesandbox.io/s/react-hook-form-defaultvalues-v6-09b8g

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • “react-hook-form”: “^7.0.0”
  • OS: macOS latest
  • Browser: All

Additional context

import { useForm } from "react-hook-form";

function Form() {
  const { register } = useForm();

  return (
    <div>
      <h2>Form</h2>
      <input name="firstName" ref={register} />
    </div>
  );
}

export default Form;

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
w3bdesigncommented, Apr 5, 2021

If you use react-hook-form version 6, then the mentioned code above will work.

1reaction
bluebill1049commented, Apr 2, 2021

the wrong version, the above syntax is for v6. Take a look at here: https://react-hook-form.com/v6/api

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Uncaught TypeError: path.split is not a function in react
I chose "react-hook-form" library. But I'm constantly getting error "Path.split is not a function. Even after using the default example given in ...
Read more >
Getting Uncaught TypeError: path.split is not a function in react
I'm trying to do validations for my form in react. I chose "react-hook-form" library. But I'm constantly getting error "Path.split is not a...
Read more >
path.split is not a function react hook use form - Code Grepper
react-hook-form updated to 7.0.0 from 6.X.X and has breaking changes: You have to replace all ref={register} with {...register('value_name')} Version 6.
Read more >
How can I solve TypeError: path.split is not a function-Reactjs
Coding example for the question How can I solve TypeError: path.split is not a function-Reactjs.
Read more >
TypeError: 'split' is not a function - MongoDB
TypeError: 'split' is not a function · Different inputs to the function when it's being run in the console/called from a webhook ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found