D
D
DeniSidorenko2020-12-22 09:08:59
Yandex maps
DeniSidorenko, 2020-12-22 09:08:59

React-yandex-maps How to make the loadSuggest function run on onChange?

Hello, it is required to use SuggestView (even without a map). Made in the following way

const loadSuggest = ymaps => {
    const suggestView = new ymaps.SuggestView("suggest");
    console.log(suggestView)
  };

<YMaps>
        <Map
          onLoad={ymaps => loadSuggest(ymaps)}
          defaultState={{ center: [55.751574, 37.573856], zoom: 9 }}
          modules={["SuggestView"]}
        />
        <input type="text" id='suggest' />
      </YMaps>


console.log(suggestView) is executed only on load, which is not surprising because it costs the onLoad event. But how to add events for changes. Or, for example, with focusOut. I need to get the address that the user wrote + additional data that returns **suggestView**
Thank you

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question