Check out example codes for "distance between two lat long points google maps api". It will help you in understanding the concepts better.

Code Example 1

google.maps.geometry.spherical.computeDistanceBetween (latLngA, latLngB);

Learn ReactJs, React Native from akashmittal.com