The efficiency of gnat traps depends on several factors. For starters, you need to examine the problem and see if you have just a minor issue, or you need to bring in the heavy artillery. You should consider placing traps throughout your house to make sure that you covered everything.
Generally speaking, gnat traps are pretty useful because these critters are not very intelligent, and, as long as a trap smells of their favorite foods such as rotting fruits, they will walk blindly into it. Getting rid of a large population of gnats also interrupts their cycle of mating, and that is why gnat traps work pretty well.