Answer the question
In order to leave comments, you need to log in
How to use ymaps.geocode in react?
Welcome all!
Here is what I found on this issue and did:
- got the key for "JavaScript API and HTTP Geocoder" and connected the API to the index.html file with my key
- added to the Map constructor: modules={['geocode']}
- and in I wrote in the Map constructor: onLoad={(ymaps) => (ymaps.geocode('Moscow').then(result => console.log('some text')))}
I run all this on localhost.
As a result, an error is displayed in the console: GET https://api-maps.yandex.ru/services/se...
net::
ERR_ABORTED 429 (Too ... Many Requests) to connect the API with a key in another way, but I can not find anything about it. Maybe someone can suggest something. Thank you in advance for your help!
Answer the question
In order to leave comments, you need to log in
react-yandex-maps is an excellent library, I used it on 2 projects, there are no problems at all, including with Yandex maps themselves.
The key itself, when using react-yandex-maps, must be entered in the query of the YMaps Provider:
<YMaps
query={{
ns: "use-load-option",
apikey: "ваш ключ api",
load: "загружаемые модули"
}}
>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question