Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

56
Views
onChange throwing error - React register method for forms

I have a custom component for a select input as below. i am passing regResult as a prop to this component. regResult is of type regResult: UseFormRegister; which is a register method.

<CustomSelect
 name="id"
 placeholder={User Id}
 regResult={register("id", {
            onChange: (e) => console.log(e)
          })}  
 doctorList={filteredDoctorList}
 disabled={!iChecked}
/>
export declare type UseFormRegister= {
  onChange: ChangeHandler;
  onBlur: ChangeHandler;
  ref: RefCallBack;
  name: InternalFieldName;
};

onChange: (e) => console.log(e) // is throwing error "Argument of type '{ onChange: (e: any) => void; }' is not assignable to parameter of type 'Partial"

can anyone tell me what exactly is the issue here. Thanks in advance

7 months ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2023 PeakU Inc. All Rights Reserved.