Dear community. Can you please tell me how you can embed Yandex maps into the react application without using additional wrappers? There is a desire to use the capabilities of the Yandex API at full capacity.
1 answer
Found this solution:
1 - connected script maps:
<script src="https://api-maps.yandex.ru/2.1/?lang=ru_RU&apikey=<MY_API_CODE>&apm;lang=ru_RU" type="text/javascript"></script> 2 - in App.js did the following:
componentDidMount() { window.addEventListener('load', this.handleLoad); } handleLoad() { window.ymaps.ready(() => { this.localMap = new window.ymaps.Map('map', {center: this.state.center, zoom: 9}, { searchControlProvider: 'yandex#search'}); }); } |