Two buttons , One Function

Heres my current code to link two buttons to the same dynamic lightbox.

import wixData from 'wix-data';
import wixWindow from 'wix-window';

/////////////////////////// LIGHTBOX //////////////////////////////////

$w.onReady(() => {
  $w("#repeater").onItemReady( ($w, itemData, index) => {
    $w("#thumbnail").onClick(() => {
 const repeaterItem = itemData;
      wixWindow.openLightbox("Learn More Lightbox", repeaterItem);
    });
        $w("#learnmorebutton").onClick(() => {
 const repeaterItem = itemData;
      wixWindow.openLightbox("Learn More Lightbox", repeaterItem);
    });
  });
});

It’s working, but I think it’s not the correct way to write a code for a same function.
Any other way to shorten the code ?

It’s easy )))

$w("#thumbnail, #learnmorebutton").onClick(() => {
    // your code...
});

or

const handlerOnClick = () => {
    // your code...
}

$w("#thumbnail").onClick(handlerOnClick);
$w("#learnmorebutton").onClick(handlerOnClick);

more: https://www.wix.com/corvid/reference/$w.html#$w

Thanks Alexander !