It is best to stay away from negative people, but sometimes we have no choice, at least for the time being. For example, it is your boss/colleague/neighbour and you bump into them every day, and they do not treat you well. It is not a good feeling, been there done that. You just want to get away from such toxicity.
So you have to deal with negative people, still stay positive. There are few ways around it.
It is better to have to the point conversations with such people. No need to engage in longer interactions where you can avoid to engage with them.
Learn from mistakes of the negative people. Don’t treat other people how those negative people treat them.Treat others better.
Avoiding them would not always work, so keep conversations to the point with them.