Check out example codes for "unity change text". It will help you in understanding the concepts better.

Code Example 1

// To change text of a text UI element use th combination below
textGameObject.GetComponent<UnityEngine.UI.Text>().text = "text";

Code Example 2

//Because the Text variable is public, 
//you will have to drag the Text box object onto the script in unity.
//So unity knows what text box to apply the script to.

public Text myText;
myText.text = "Enter the text value here!";

By: Barry Cox

Learn ReactJs, React Native from akashmittal.com