1st pregnacy and mc

So how do you cope with it? I was 9weeks and 5 days and i started spotting the day before yesterday didnt really pay mind to it bc it went away after. Last night i went to the restroom and it seemed as tho i had started my period. I rushed to the er with my husband right away and after 3 hrs of testing and the ultrasound they told me unfortunately there is no heart beat so no baby.:"(( I wasnt really expecting that. Im the first in my family to have a misscarriage and its a hard one to swallow since we were very excited and full of hope and I thought I was fine and it couldn't happen to me. Why? How do I deal with these feelings that I have. It was my very first pregnancy and I'm 25 and I know I can try again but now I'm scared to try it again thinking that this could happen again. Im very devastated:'(