IonSearchBar not updating the searchText state on ionChange

const [searchText, setSearchText] = useState(’’);
const handleSearch = (searchValue: String) => {
console.log(“search value” + searchValue);
console.log(“search text” + searchText);
};
<IonSearchbar
value={searchText}
onIonChange={(e) => {
setSearchText(e.detail.value!);
handleSearch(e.detail.value!);
}}
placeholder=“Search” >

on typing anything in the search bar it gets cleared automatically and the logs print nothing

Works fine for me. Here’s a Stackblitz example.

There was an issue with one of the react hooks which was rendering the page multiple times causing that behaviour. Fixed now.