It sounds exceedingly simple: write what you know. In practice, the ability to write is something that takes time. However, the knowledge behind what you’re writing is something else entirely. It’s almost like the difference between knowledge and experience.
You can write about the Congo, but if you’ve never been, you’re writing about something you’ve never experienced. It’s a figment of someone else’s memory.
This isn’t to discourage you from writing something you’ve never experienced, in fact quite the opposite. I feel the idea that you should ONLY write what you know to be a fallacious argument. Just because it’s better for someone to write what they know doesn’t mean they can’t write what they don’t.
Speculative fiction makes its business out of writing what it doesn’t know. Are there actually aliens bombarding Earth right now? Have vampires sucked your blood recently? There’s certainly a difference when you write general fiction, but genre fiction isn’t bound by those rules.
Write what you know, of course, but also don’t write off what you don’t! Learn from everything, and translate it through your words into your writing.