Code Monkey home page Code Monkey logo

Comments (2)

bluebill1049 avatar bluebill1049 commented on May 29, 2024

please read the doc and refer on how to use useFieldArray. there is not even a register

from react-hook-form.

szilard-dobai avatar szilard-dobai commented on May 29, 2024

@bluebill1049 Thanks for replying, but unfortunately I'm still having problems understanding how you're supposed to be using these functions. Maybe my initial code sandbox example was oversimplified, but this one is closer to what I'm actually trying to do.

In short, I want to display one single set of inputs at a time for each object inside my array field and the user can navigate through them using 'next'/'previous' buttons, as well as having a scrollable overview of the entire array on the side (omitted in the example).

How and when am I supposed to call register? Calling it once for the entire "people" array field (like in the example) acts as if the entire field becomes dirty once I type something in 1 single input even though I did not touch the others, meaning that clicking the trigger new data button doesn't update all expected members of the "people" array.

Calling register('people.${currentIndex}.name') and destructuring the result in each <input> isn't really an option for me because I'm using custom and conditional components that aren't actually HTML inputs...

from react-hook-form.

Related Issues (20)

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.