This. /\hands on top of bars and keep tapping out the rythm -not panicking and jumping out of the saddle - keep your breathing under control.
I love climbing hills (most times ) and over the years its what I've learnt to do. With the above method I just take it nice and easy and work my way to the top. Im not the fastest but I'm not bothered about that. Many a time I've been overtaken by a racing snake on a long or steep hill to find them out of puff, resting at the top whilst I just pootle on by.
I'm lucky at the age of 56 that my fitness is still pretty good. I run a compact chainset on my Van Nick Road bike, 50/34 with an 11/25 cassette on the back. I'll soon be changing the crankset to a super compact, 46/34 as I do like the closer gears without the big jumps.
My touring/commuter bike runs a super compact chainset already with an 11/28 cassette. That helps me gets be up any hill or mountain without much problems or causing me to near die of exhaustion.