By default, when a user enters text into your Autocomplete search bar and then clicks a button outside of Autocomplete to navigate to a new page, the text will still remain in Autocomplete.
If you prefer to clear this text when a user navigates to a new page you can use the setQuery
state setters returned by autocomplete()
. You can hook into your navigation logic and call setQuery('')
when the navigation to another route is triggered. This will clear out the autocomplete search input. You can find more information on Autocomplete's handling of state in this guide.