Check out example codes for "in unity i want to destroy a gameobject when it hits the edge of the screen". It will help you in understanding the concepts better.

Code Example 1

using UnityEngine; 
 using System.Collections;  
 
 public class CarDetection : MonoBehaviour {
 	private Camera mainCamera;
    public Vector2 widthThreshold;
    public Vector2 heightThreshold;
    
    void Awake () {
    	//Get your mainCamera here. If you are pretty sure that the camera is always the Camera.main you don't need to implement here. Just call for Camera.main later.
    }       
    void Update () {           
    	Vector2 screenPosition = mainCamera.WorldToScreenPoint (transform.position);           
        if (screenPosition.x < widthThresold.x || screenPosition.x > widthThresold.y || screenPosition.y < heightThresold.x || screenPosition.y > heightThresold.y)  {         
        	Destroy (gameObject);
        }
    }
}

Code Example 2

// this does take into account EVERY camera, including the editor view one
// but that shouldn't be a big deal once the game is built

void OnBecameInvisible() {
 	Destroy(gameObject);
}

Learn ReactJs, React Native from akashmittal.com