The transfer form of function parameters in JS is simple
Function Show (s) {
Console.log (s);
}
Show (' Hello '); It will output hello.
Bind is required for the transfer of function parameters in react JSX
Here is an example that can be used as a reference
http://www.jianshu.com/p/d745514e547b
Note that you have to define this and then use it, and use this directly to give an error, and the function defines
The Bind method is required to bind the parameter, the first parameter points to this, and the second argument starts with the parameter that the event function receives
Here's an example to illustrate everything.
var NoLink = React.createClass({
show: function(dd){
alert(dd)
},
render: function() {
function show(rr){
alert(rr)
}
var o = this;
var message = [1,5,7,9,0];
var sss = message.map(function(data){
return(
<input type="button" value={data} onClick={o.show.bind(data,data)} />
)
})
return(
<div>
{sss}
</div>
)
}
});
ReactDOM.render(
<NoLink />,
document.getElementById(‘example‘)
);
React the transfer of function parameters