Relay

Relay module, e.g. 5 V SRD-05VDC

A relay is a switch flipped by an electromagnet, so a small circuit can safely switch a big one, like a 230 V lamp.

COM, NO (normally open) and NC (normally closed) are the switch side. Use NO for 'on when the relay clicks'.

Mains wiring can kill. Keep 230 V work for an adult, in a closed box.