Check out example codes for "unity how to lock rotation". It will help you in understanding the concepts better.

Code Example 1

public float lockPos;

	void Update()
	{
		// Locks the rotation.
		transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, lockPos, lockPos);
	}

Learn ReactJs, React Native from akashmittal.com