Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

58
Vistas
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
Responde la pregunta
Encuentra empleos remotos