You may or may not have heard about a number of writers "writing to market." If you have, here you go: writing to market translates into writing what's hot and popular at the moment. Although there may be a few outliers who have found short-term success in this arena, long-term this may be the wrong way to go.
First, unless you can churn out a book a month or two, it may be difficult to gauge what is currently hot. And even then, what may be hot at the moment may not be the next.
I'm not knocking against people who do this. If it works, do it.
I, however, respectfully disagree. It all comes down to what one loves to write.
Here's an example from me.
I primarily write fiction, and primarily in the thriller, horror, fantasy, or science fiction genres. Could I write a nonfiction book? I have. It's a wedding ebook titled "Debt Free I Do." Now, one of the hot genres is romance. Have I ever thought of writing a romance book? I have. But not right now. I'm in the middle of several projects and quite frankly a romance book is far off my radar for the upcoming year or two.
But one day I will. It might be under a pseudonym even.
Being an indie author, I write what I feel like writing. Thrillers are typically always in demand, ebbing and flowing depending on what else is out there, so I'll keep on that track.
Again, if you want to give something a try, by all means do it.