Need help convert to Aync code

Hi currently Im using this code to load data from the database and filtering it with onClick function. My page is loading very slow and I’m not able to enter data in the Text Box. After some research, I found that Async function loads data comparatively faster from the database. I’m new to code and want to convert it to the async function.

import wixData from 'wix-data';

$w.onReady(function () {
	$w('#table1').collapse();
});

export function submitButton_onClick() {
	wixData.query('Datacollection')
		.contains('hallNo', $w('#Textinput1').value)
		.find()
		.then(res => {
			$w('#table1').rows = res.items;
			$w('#table1').expand();
		});
}

You are using async . The query() function returns a Promise and the .then() function is the fulfillment of the Promise . See the following articles for more information:

  • Wix Code: Working with Promises

  • Promises, Promises
    Async does not load that data faster. Rather, async allows the program to continue running other commands while at the same time the data is being loaded. Once the data is loaded, the .then() function is triggered and the data is then available.