Check out example codes for "unity assign button onclick". It will help you in understanding the concepts better.
Code Example 1
public Button yourButton;
void Start ()
{
Button btn = yourButton.GetComponent<Button>(); //Grabs the button component
btn.onClick.AddListener(TaskOnClick); //Adds a listner on the button
}
void TaskOnClick()
{
Debug.Log ("You have clicked the button!");
}
Learn ReactJs, React Native from akashmittal.com