Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

293
Vistas
How to make keyPress activate a handleClick in Typescript/React

Making a simple registraction form in React/TS, and I'm trying to make the Enter key perform the role of clicking Next. It should do everything that the next button does, which is defined in handleClick.

    function handleKeyPress(e: React.KeyboardEvent<HTMLDivElement>) {
        if (e.code === "Enter") {
            handleClick( // some argument here // );
        }
    }

    function handleClick(e: React.MouseEvent<HTMLButtonElement>) {
        if (!first || !last) {
            return setError(true);
        }
        step(e, `${e.currentTarget.name}`);
        updateName(e, first, last);
    }

I cannot work out which argument to pass to handleClick, in order to satisfy Typescript. It requires 1 argument.

I have tried passing e: React.MouseEvent, and variations of arbitrary arguments. What am I missing here?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda