M
M
Mans2019-09-04 15:04:53
JavaScript
Mans, 2019-09-04 15:04:53

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

2 answer(s)
A
Alexey, 2019-09-05
@ms95

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: "загружаемые модули"
  }}
>

G
grinat, 2019-09-04
@grinat

Yandex.maps is already shit, and you also dragged the left plug-in, the meaning of which is zero, it will generally be on the page with it. Take a leaflet and you will forget about all the problems.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question