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

Code Example 1

// TO change the sprite of an UI image, se below
GameObject.GetComponent<Image>().sprite = sprite;

Learn ReactJs, React Native from akashmittal.com