Check out example codes for "html onclick can't find function". It will help you in understanding the concepts better.

Code Example 1

<!--
	Your script is most likely after your HTML.
	Include it before html, so that your function is defined.

	Another reason your function may be undefined is beacuse there is 
	some kind of error blocking your function from exectuing!
-->

<script>
	function BtnPress() {
		console.log("I work because i am defined before my caller!");
    }
</script>

<button onclick="BtnPress()">Press Me!</button>

Learn ReactJs, React Native from akashmittal.com