If you're invited : bring some flowers or a bottle of wine or champagne.
Give the flowers to the hostess and the wine to the host.
If it's the first time you are invited, you don't need to bring some food, it could be regarded as too familiar. Just bring some wine and / or flowers.
But if it's not the first time you're invited and you want to bring some food (a dessert is the most common thing we bring), tell the hosts when they invite you :
« D'accord, j'apporte le dessert »
They should refuse at first : « non, non »
But it's a typical polite interaction. So you can insist :
« Si, si, j'apporte le dessert »
Then, you make a proposition : « Du chocolat ? », « De la glace ? »
For Christmas, if you bring an ice cream, it will be a « vacherin », if you bring a cake, it will be a « bûche ».
If your friends have kids, bring a small present for them.