Sentinel’s last function. What comes first, the attack or the reaction?

Quick question of the order between enemy actions and friendly reactions.


• Whenever you hit a creature with an opportunity attack, its speed drops to 0 for the rest of the turn. This stops any movement they may have been taking.

• Creatures within your reach provoke opportunity attacks even if they took the Disengage action.

When a creature within your reach makes an attack against a target other than you (and that target doesn’t have this feat), you can use your reaction to make a melee weapon attack against the attacking creature.

Does this happen before the enemy’s attack goes through? So the player have a chance to kill the attacking creature before he attacks the players party member? Or does the enemy’s attack connect first, giving the player an opportunity to attack the enemy?