Reactjs doubt about nomenclatures

Asked

Viewed 39 times

0

Hello,

I am studying Reactjs and I have a question regarding the nomenclature of functions.

I see in the tutorials and in the post the staff always put:

handleClick; handleSend

What is this Handle? And Use?

Thank you

1 answer

2


The translation of "Handle" would be "handle", this term is used when you want to link a certain programming (function) to some event of your system (eg "handleClick" would be the programming executed when a certain element is clicked).

This nomenclature is not mandatory, you can use the names you think best. What you need to maintain is the "camelCase" standard when naming these functions. For example, you could not have a function called handlesend, the correct one would be "handleSend"

Here’s a link explaining how this works better:

https://reactjs.org/docs/handling-events.html

  • It’s because I like to use it like this: salvarProduct - editarProduct - excluirProduct. So I identify but fast which function is being called

  • Good answer Bins, complementing also, I recommend you see the tutorial of Macoratti link

Browser other questions tagged

You are not signed in. Login or sign up in order to post.