JSFiddle - React, Tailwind, and code Playground

HTML

<button onclick="mapsSelector('47.91', '-122.02')">
Test
</button>

JavaScript

function mapsSelector(locationLatitude, locationLongitude) {
    if /* if we're on iOS, open in Apple Maps */
        ((navigator.platform.indexOf("iPhone") != -1) || 
        (navigator.platform.indexOf("iPad") != -1) || 
        (navigator.platform.indexOf("iPod") != -1))
        window.open("maps://maps.google.com/maps?daddr="+locationLatitude+","+locationLongitude+"&amp;ll=");
    else /* else use Google */
        window.open("https://maps.google.com/maps?daddr="+locationLatitude+","+locationLongitude+"&amp;ll=");
}