react check if localhost
if (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname === "") { alert("It's a local server!"); }
Source: stackoverflow.com
if (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname === "") { alert("It's a local server!"); }