Clean the house and kitchen
Fruit flies prefer dirty so dry surfaces where they cannot easily spread. When you clean the home, especially the kitchen where food is kept, remove any sugar traces, crumbs, or ripe fruit that can attract fruit flies. It's a solution like cleaning fruit baskets, cabinets, and countertops thoroughly with soap and water or a dedicated kitchen cleaner. In order to stop fruit flies from growing and multiplying, keep the sink free of food scraps and dirty dishes.
Fruit flies adore looking for ripe, decaying fruit so they can consume the nectar. Fruit flies will be drawn to overripe fruit in the home, including ripe bananas, berries, peaches, and peeled plums. When buying fruits and vegetables at the grocery store, don't choose overripe ones and store ripe fruit in the refrigerator. Flies can also be attracted to beer, wine, and juice. Therefore, in order to prevent fruit flies from accumulating, it is necessary to remove the old bottles and clean them up immediately after drinking.