Break Beam

I'm wanting to use a break-beam as a switch, which will, when broken, open a normally closed solenoid. The solenoid will need to stay open until the beam is restored and then return to the closed position. The solenoid will allow me to dispense liquid through an atomizer nozzle. I've found how to operate a solenoid from my Arduino UNO and I can also get a break beam (Adafruit IR Break Beam Sensor - 5mm LEDs) to work, but how do I integrate them to work together?
Any help is gratefully received! Thanks!!

You write code that sets up the operations, setup(), and write code, in loop(), that will check the broke beam and do the thing.

Why do you need the Arduino for this? You should be able to use the beam sensor output -- with a little bit of a circuit -- to switch that solenoid directly.

The Arduino isn't adding anything -- no additional delay, timing, qualification etc: Just beam broken, open solenoid, beam restored, close solenoid. Just do it in hardware.