dnd 5e – Can you use reaction class features when receiving damage that tramples over polymorph

Is it possible to use a reaction from your class when you take damage that tramples over to you ?

For example, let’s say you’re playing a rogue and your friendly wizard polymorphs you into a giant ape. Battles continues, and after a failed dexterity saving throw, you take 50 damage. Since your giant ape only had 10 hp left, you take 40 hp to your rogue health. Since you’re not under the Polymorph spell, can you use your reaction to do Uncanny Dodge and only take half of the 40 damage you’re taking?