Research and knowing about it helps although really in the end it's just like writing any other character, but this one happens to be transgender with their own issues. People are just people, have all the same goals, conflicts and needs and not all misrepresentation is hate speech, most of the time it's poor understanding of an issue or just plain lack of research.
I remember a bunch of asexuals on an ace forum kept talking about how a certain writer was pure evil because god forbid she didn't understand what asexuality was (not many people fully understand it, I know. It's not new news, shit happens) and described one of her ace characters in a way that isn't 100% accurate. Maybe she made a mistake or not or just didn't know. It's not the end of the world.
And really if making mistakes is wrong then how do you learn from them? That's just how someone learns to write a character. We've had a lot of writers make terrible characters that were questionable but years later with practice they have more developed characters that are more real and true to life.
In the end just try to face this from a writers perspective and try to do the best as you can, look things up and talk to someone if you need to. There's no specific guide or way to make a character, saying simply "don't make them offensive" just is very vague.