Maybe I'm not the best person to talk about how to deal with rejection. I've only been rejected by five or six separate journals. Really crappy journals have not rejected me, mostly because I don't submit to them very much, so I've only been turned down by the best. There are only two journals that I've tried but have yet to accept me. What pains me more is that two of my best articles were never published at all.
So how to deal with rejection?
The first thing to consider is that nobody sees on your cv a list of rejected articles. Someone reading a cv only sees what you've published, not the fact that you might have had some rejections along with way.
Secondly, nobody has a 100% percent acceptance rate. Not me, not anyone I know. The closest I can think of is my brilliant spouse.
If you submit to very good journals, your acceptance rate will go down. About 80% of my rejections have been for PMLA and Hispanic Review. So if you submit to very good journals, you have to expect rejection and not take it as a big deal if you are trying to get into prestigious journals. Even a very good article might be turned down.
Sometimes a journal was correct to reject you. I know that's true in my case. At one point I got complacent and started to send things out that weren't very polished. The field, in its collective wisdom, quickly told me not to do that.
The journal does not care about you. It is not a personal rejection. It is a rejection of your work. I know that still feels bad, but it is rarely personal.
Eventually, if you do good work, you will get accepted. Later on I will tell you how to submit an article to maximize your chances.