MenuItem in electron


I am new to electron. I want to know how to use menuItem in electron using vs code
I have written some code

const Menu = electron.Menu
const remote = electron.remote
const MenuItem = electron.MenuItem
const menu = new Menu()
const menuItem = new MenuItem()({
label: ‘Inspect Element’,
click: ()=> {
remote.getCurrentWindow().inspectElement(rightClickPosition.x, rightClickPosition.y)



window.addEventListener(‘contextMenu’, (e) => {
rightClickPosition = { x:e.x,y:e.y }

But I am getting error that ‘Can not read property ‘click of undefined’’