Check out example codes for "how to keep a rigidbody upright using torque". It will help you in understanding the concepts better.

Code Example 1

var rot = Quaternion.FromToRotation(transform.up, Vector3.up); 
 rb.AddTorque(new Vector3(rot.x, rot.y, rot.z)*uprightTorque);

Learn ReactJs, React Native from akashmittal.com