There are two ways to handle rejection.
You could take it personally. Feel wounded; rant and rave about the unfairness of it all. Obsess about the nuances of the note that came with the rejection, and pick out every shred of meaning that you can from “sorry, not for us”. You could reply to the person who so callously rejected you, and explain to them in careful detail why they were wrong to do so; you could even stop writing, your writerly sensibilities to damaged for you too continue.
Or you could remember that it’s not you that’s been rejected, it’s a piece of writing and that writing doesn’t have feelings, and so won’t care. You could realise that there are many more aspiring writers out there than the publishing world can accommodate, and that you need to learn to write better, target more accurately, or do both, in order for your work to be accepted. You could realise that the editorial assistant who sent you that swiftly scribbled note did not do so in order to upset you and that what was meant by “sorry, not for us” was that they were sorry, but for one reason or another your work did not suit them. If you manage to do all this then you’ve probably been writing for a while, understand how the industry works, are used to the odd rejection, and are far more well-adjusted than I.