Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

836
Views
¿Por qué `MouseEvent` en el controlador de eventos de la casilla de verificación no es genérico?

Tengo un elemento de casilla de verificación TSX (JSX):

 <input type="checkbox" name={i.toString()} onClick={this.handleCheckboxClick} />

Con la ayuda del código VS, sé que el tipo de parámetro de entrada de this.handleCheckboxClick es MouseEvent<HTMLInputElement> . Así que lo implementé con:

 private handleCheckboxClick(event: MouseEvent<HTMLInputElement>) { ... }

Luego aparece un error que dice [ts] Type 'MouseEvent' is not generic. Como se muestra en la imagen a continuación:

ingrese la descripción de la imagen aquí

Versión de mis paquetes:

 "@types/react": "^15.0.29", "@types/react-dom": "^15.5.0", "react": "^15.6.1", "react-dom": "^15.6.1", "typescript": "^2.3.4",

¿Porqué es eso?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Probablemente estés usando el DOM MouseEvent . Intente usar React.MouseEvent<HTMLInputElement> en su lugar.

over 4 years ago · Santiago Trujillo Report

0

Para usar React MouseEvent, solo asegúrese de agregar:

 import { MouseEvent } from 'react';
over 4 years ago · Santiago Trujillo Report

0

Puede usar SyntheticEvent en lugar de MouseEvent

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!