When my daughter does something dangerous or harmful (to herself or others) my goal is to figure out what I can do to maximise the likelihood that she learns not to do it again or what to do instead. Getting mad might help sometimes, cause it can instil a sense of how severe the consequences of her actions could be, but most of the time it’ll just make her defensive and stubborn, so I usually find it more effective to explain to her what the problem is, calmly and objectively, and get her to reason about it herself. But yeah, I mean, if she’s very upset I gotta help her calm down and feel better first, cause nobody learns well when they’re upset and stressed out.