I get this error every time I try to add a map marker to my map
leaflet.js:5 Uncaught TypeError: t.addLayer is not a function at i.addTo (leaflet.js:5). This function is part of the library and I have no clue why it doesn't work. My code comes from the developers portal at tomtom. Here is my code.
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel='stylesheet' type='text/css' href='sdk/map.css'/>
<link rel="stylesheet" href="style.css">
<script src='sdk/tomtom.min.js'></script>
<title>Document</title>
</head>
<body>
<header class="name-header">
<div class="name-wrapper">
<nav class="container">
</nav>
</div>
</header>
<div class="img-wrapper">
<div class="svgbox">
</div>
</div>
<div id="map"> </div>
<script>
var storeLocation = [35.677512,-81.99855]
const map = tomtom.setProductInfo('KG\'s', '<your-product-
version>');
tomtom.L.map("map", {
key: 'myapikey',
source: 'vector',
center: storeLocation,
basePath: '/sdk',
zoom: 15
});
var marker = tomtom.L.marker(storeLocation).addTo(map);
marker.bindPopup("my business").openPopup();
</script>
</div>
</body>
</html>
My map size is declared in my css
You assigned map to a what is returned from setProductInfo method. It should be assigned to tomtom.L.map.
const map = tomtom.L.map("map", {
key: 'myapikey',
source: 'vector',
center: storeLocation,
basePath: '/sdk',
zoom: 15
});