Fungus gnats are pretty common and usually not a huge issue. They result from not allowing your top soil to dry out enough between waterings.
To rid your grow of gnat larva, place slice(s) of raw potato on the soils surface and leave a while. If you have gnat larva in your soil, they are drawn to the potato. Check the potato after 12-24 hrs and you may see the larva there. If so, toss the infested piece and replace. When you don't find larva on the potato 2-3 X's in a row, they're gone.
The adults lay eggs in moist soil. The layer of sand is often used after grow is clean of gnats.
IMO, they are not a big deal unless they get out of hand, which I've never seen happen.