JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE html>
<head>
	<meta charset="UTF-8">
	<title>Page Title</title>

	
	<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>

	
 <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
     integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
     crossorigin=""/>
   
 <!-- Make sure you put this AFTER Leaflet's CSS -->
 <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
     integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
     crossorigin=""></script>
</head>

<body>
<a href="#" class="gps_btn">--------------KLIK-----------------</a>
<div id="map2" style="height:100%"></div>


<script>
var geo_s=52.5185;
var geo_d=18.3183;
var map2 = L.map('map2').setView([geo_s, geo_d], 15);
L.tileLayer('https://{s}.tile.osm.org/{z}/{x}/{y}.png', {attribution: '&copy; <a href="https://osm.org/copyright">OpenStreetMap</a> contributors'	}).addTo(map2);

var tujestes;
$( document ).on( "click", ".gps_btn", function () {
	//$('#map2').height(	$(document).height());

	
	console.log(typeof tujestes);
	
	if(typeof tujestes!=='undefined'){
		
		console.log("czemu tu nie wchodzi do pętli?");
		
		map2.removeLayer(tujestes);
	}

	 tujestes=L.marker([geo_s,geo_d]);
	tujestes.addTo(map2);


});
</script>
</body>
<html>

CSS

html,body{
  height:100%;
}
#map2{
  height:100%;
}