In my view there are two conflicting strains of advice for authors regarding what they should write. One, which I’ll call the “write what you know” advice, claims that writers are most successful when they write about what they know intimately. Authors need to know a subject before they write, according to this advice.
The other line of thinking, let’s call it the “research before you write” advice, suggests that authors research carefully not only the subject but for the market for a book to make sure there is some kind of market for the book. Authors, this idea claims, should write what will sell, not just whatever they happen to know about.
If you ask me, both views are simplistic, at least.