How To Read Autocomplete's Current Search Box Text?

If I have access to the autocomplete object, search , returned from search = autocomplete(...options) , what is the best way to read search 's current query value (i.e. the text that is currently typed into the search box)?

It looks like the .getVal() method mentioned here was deprecated, and the upgrades section of the docs does not offer an equivalent method.

Thank you for your help!

P.S. This is a duplicate of this question, but no one has responded to that one yet, so I’m bumping it here.

Hi :slight_smile:
Check this part → Controlling Behavior with State | Algolia Documentation

I think is just →

autocomplete({
  ...
  onStateChange({ state }) {
    console.log(state.query); // Actual value
  },
});

Check the link I sent you, very clear about states.

Best,
Julián