I've been in both situations - losing babies and being the person lucky enough to be pregnant and have to break it to someone else who had lost babies.
I agree with the sentiment that no-one else can have your baby. My SIL announced she was pregnant just as I was bleeding from mc our one, so I know how hard it can be. But I showed nothing but joy as she had a previous mc, so I was genuinely happy for her too and squashed my jealousy.
I always try, however bad I feel, to treat other people as I would want to be treated in this situation.
So even when it hurt, I said congratulations to pregnant friends and tried to take an interest, comforting myself that this wasn't my baby. In the same way, my friend who recently had two mc kindly enquired after my health recently (I'm pregnant) and I assured her I was fine and then moved onto another topic rather than go on about anything that might hurt her.
Rather than ignore a good friend or be ignored, I'd rather someone said or texted: "Congratulations! I'm so pleased for you. Really thrilled; amazing news. Please understand if I don't ask loads about the pregnancy as things are still raw for me after losing my own baby, but I want you to know I am so happy for you. Lots of love. xxxx"
Obviously though the most important thing is that you do whatever makes you feel best, OP, so feel free to ignore that advice. And I am so sorry to hear about your loss.