How to pass arguments to functions in React js?

Posted by Jessica Taylor | Updated on

If you want to know how to pass arguments to functions in ReactJS? You can achieve this by using arrow functions. See the below example:

onClick the anonymous function is called and executes this.displayAlert(item.email)

The ES5 way:

You could do this using .bind and passing the parameter in there. You should also pass this or use bind to keep the proper context on your .map function:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers