Check out example codes for "Uncaught ReferenceError: function is not defined at HTMLUnknownElement.onclick". It will help you in understanding the concepts better.
Code Example 1
//Your program can't find the function so do this.
//You can assign the button onclick as an id.
//then attach an eventListener on run time like this:
<button id="btn">Click me!</button>
var btn = document.getElementById("btn");
btn.addEventListener("click", function() {
//Do something here
}, false);
Learn ReactJs, React Native from akashmittal.com