Check out example codes for "play animation through script unity". It will help you in understanding the concepts better.

Code Example 1

animator.Play("StateName");

Code Example 2

public GameObject ExampleNPC;

void Update()
{
    if(Input.GetButtonDown("Animation")) // Make sure to refrence this in Input settings
    {
        ExampleNPC.GetComponent<Animator>().Play("Anim name");
    }
}

Learn ReactJs, React Native from akashmittal.com