The goal of this code is to fetch data continuously, not just once. while (true) ensures that the fetchProducts function will run indefinitely until it is interrupted externally. If you remove while (true), the fetchProducts function will only execute once, returning 2 pieces of data and then ending.