How to tell someone who’s experienced a loss

Just wanting some advice!

I’m telling my cousins who I’m pretty close with that I’m expecting!

One of them had a loss this year and I’m just wondering how to approach it as I know she will be happy for me but also upset at the same time.

It will be through message as we live in different cities and won’t see each other for a while. I just don’t want to feel like I’m rubbing in her face or anything because i would never!

Just wondering if anyone has had a similar experience or has been on the other end of it to give insight