There are two answers to this question and they point in opposite directions. The interesting part is that the evidence supports both.
The one everybody knows
The widely-cited finding is about personality: people who report trolling more also score higher on a cluster of traits associated with enjoying others' distress. It is a genuine result and it has been repeated.
It is also the half of the picture that gets quoted, and it has an unfortunate effect on readers. If trolls are simply a type of person, then the people provoking you are a separate category, permanently, and the only question is how to identify them.
The one that changes what you do
The counterweight is a study that took ordinary users rather than self-selected trolls, and manipulated their circumstances instead.
[1]Two things follow from that, and both are uncomfortable.
Trolling is partly contagious. Seeing it makes people more likely to do it. A thread does not contain a fixed number of hostile people; it produces more of them as it goes.
You are not exempt. The mechanism is mood plus exposure, and both of those apply to everyone, including the person reading this page while annoyed about an argument they are losing.
Why this matters for what to do
If provocation were purely dispositional, the response would be identification: work out who the trolls are, exclude them, done.
If it is substantially situational, then the most useful lever is the thing you control — whether your reply raises the temperature for everyone else reading. That is a much less satisfying conclusion than "some people are just like that", and it is better supported.
It also reframes the advice this site is named after. Declining to reply is not only about starving one person of a reaction. It is about not adding to the exposure that makes the next person more likely to join in.