Git Product home page Git Product logo

Comments (3)

Jay-study-nildana avatar Jay-study-nildana commented on July 17, 2024 20

This evening, I was stumped by this for a while. putting the full code if it helps somebody.

  <form onSubmit={handleSubmit}>
    <input
      {...register("search")} defaultValue={criteria}
      placeholder="type here"
      type="text"
    />
  </form>

from asp.net-core-5-and-react-second-edition.

carlrip avatar carlrip commented on July 17, 2024 6

The API in React Hook Form has changed a little since the book was published. You can install v6 as follows if you want to use the code from the book:

If you want to use v7 of React Hook Form, see the following link for the differences:

https://react-hook-form.com/migrate-v6-to-v7/

For the code in the book, you’ll need to change how the register function is called on the JSX elements and how the errors state variable is destructured from useForm.

Hope this helps.

from asp.net-core-5-and-react-second-edition.

abase0001 avatar abase0001 commented on July 17, 2024 2

I met the same error. If you installed react-hook-form v7.1.1, you can refer to the author's example.
https://codesandbox.io/s/react-hook-form-get-started-ts-5ksmm?file=/src/index.tsx

from asp.net-core-5-and-react-second-edition.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.