What do you do after a rejection?

Suppose you prepared for an interview for over a month, day in and out you studied hard and get a rejection on the same day of the interview, what do you do after that? How do you process the different feelings and thoughts inside your head? I had this experience and I almost feel like I'm grieving.