MenuItem in electron


#1

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)
}

})

menu.append(menuItem)

window.addEventListener(‘contextMenu’, (e) => {
e.preventDefault()
rightClickPosition = { x:e.x,y:e.y }
menu.popup(remote.getCurrentWindow())
},false)
`

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