"You fail only if you stop writing" -- Ray Bradbury
Bradbury never did stop writing, not until he stopped breathing. He gave you the feeling they were pretty much the same thing.
After the 99th rejection or a few particularly frustrating incidents it can be tempting to stop, but one thing I've found helpful is to switch to a different genre or even a totally different type of writing for a while.
I've spent a lot of my career writing scripts but when I got fed up with some of the more aggravating aspects of that, I switched to writing non-fiction books.
Since then I've tried something totally new for me, a young adult novel and a book for kids.
Yes, it's good to focus your efforts because breaking in to any type of writing is a challenge and you don't want to spread yourself too thin. However, as the saying goes, sometimes a change is as good as a rest.
(You'll find great writing advice from Ray Bradbury and many other classic and modern authors in my book, Your Creative Writing Masterclass. It's published by Nicholas Brealey and available from your favorite bookseller.)