My hydro grows always have a few fungus gnats. They came with the botanic are coco, all for free. Lucky me.
They don't really do all that much to mature plants unless it is a literal infestation and even then, they can be taken care of. First, what is the setup? Is it dwc or something else? I have to let the coco completely dry at the top. I have been told, but have never tried, a layer of sand at the top or something that dries out very easily. If the top remaining wet is the issue, sand should work.
My issues is the dwc arise when I let the water level climb and keep the coco saturated. Dropping it below the net pots solves that. There is also gnatrol, bacillus thurengiensis, and it eliminates them. Frankly, I ignore them, but I never really see flying gnats.