It's necessary to pass in `null` for the style URL when using map options. This isn't clear in the documentation. This is especially noticeable for users trying [to migrate from Classic styles to the modern Static Tiles endpoint](https://docs.mapbox.com/help/troubleshooting/migrate-legacy-static-tiles-api/?/=blog&utm_source=mapbox-blog&utm_campaign=blog%7Cmapbox-blog%7Cdoc-migrate-static%7Cdeprecating-studio-classic-styles-d8892ac38cb4-20-03&utm_term=doc-migrate-static&utm_content=deprecating-studio-classic-styles-d8892ac38cb4#mapboxjs-implementations). Map does not render with `tile_layer.js:49 Uncaught TypeError: Cannot read property '0' of undefined` error: ``` var map = L.mapbox.map('map', {maxZoom: 3}) .setView([40, -74.50], 1) .addLayer(L.mapbox.styleLayer('mapbox://styles/mapbox/streets-v11')); ``` Map renders as expected: ``` var map = L.mapbox.map('map', null, {maxZoom: 3}) .setView([40, -74.50], 1) .addLayer(L.mapbox.styleLayer('mapbox://styles/mapbox/streets-v11')); ```
It's necessary to pass in
nullfor the style URL when using map options. This isn't clear in the documentation. This is especially noticeable for users trying to migrate from Classic styles to the modern Static Tiles endpoint.Map does not render with
tile_layer.js:49 Uncaught TypeError: Cannot read property '0' of undefinederror:Map renders as expected: