dnd 5e – How viable is it to hide as a bonus action(BA) when using spell attacks, compared to using a BA spell + a cantrip?

If you have access to the hide action as a Bonus Action (BA) (either as a goblin or through rogues cunning action), how viable or advantageous is it use it often to get advantage on spell attack rolls, compared to (what I imagine is the strongest alternative) using a BA spell and cantrip on the same turn?