Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

195
Visualizações
In react native, calling a function in React

I am a newbee, I sorry all if my question is wrong

This is a code, I refer React tutorial:

<form onSubmit={() => handleSubmit(createUser)} className={classes.form}>

I wanna ask that:

  1. Why my they used a inline Arrow Function ?
  2. And what happen i cannot use to use it ?
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

1 Sub Question Answer:

Inline Arrow Function is created on render because the function definition is inside of the onClick handler, which is inside of the component render method (or return, in the case of functional React components).

You’d use an inline function to pass in additional arguments to a function, such as a value from a loop, or the target button’s value.

Let’s take a look at an example:

import React from 'react';

function App() {
  return (
    <button onClick={() => alert('hello'))}>
      Click me!
    </button>
  );
}

export default App;

2 Sub Question Answer: You can use to use it. You can take a look at different ways you can do the onClick Event Handling here

about 4 years ago · Juan Pablo Isaza Relatório

0

The 'anonym/arrow-function' function is for pass the reference of the function, and that reference react will call when detect the event. Is like variable storage

If you cant use it, you can pass a reference of a normal function

const handleSubmit = (...args) =>  {}
<form onSubmit={handleSubmit} className={classes.form}>

the args will get all event parameters of anything that event handle

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda