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

197
Views
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 answers
Answer question

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 Report

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 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!