I´m pretty new to react-hook-form but I like it so far. I´ve managed some scenarios with simple validation together with material-ui and its working pretty well.
Right now I´m having a problem where I´m totally out of Ideas and I was hoping that somebody can help me out there.
I try to explain the problem as best as I can.
I have a global number which refelects a users membership in teams. This number represents the maximum amount of memberships of a given user. A user can then be assigned to teams. The data comes from a database. It is now possible to change the proportion of a team membership a user belongs to, but together they cannot exceed the global limit of the current user.
I´m currently totally out of ideas. The validation should check if the teamValues together do not exceed the global total number. I tried to use useFieldArray for that example which works pretty well but I have no idea how I should build up the component and the validation.
I provided a code sandbox with a rudimentary example which reflects what I currently have. Maybe someone can help me out here! Maybe useFieldArray is not the best option here but I have no idea what I can or should use instead :-).
Thanks a lot!!
Link to codesandbox:
https://codesandbox.io/s/lingering-mountain-2is19?file=/src/App.js