Add contextmenu to your react component with ease
npm install @lilanjun/react-contexify
!React-contexify CI ![npm]() ![npm]() ![license]()
sh
$ yarn add @lilanjun/react-contexify
`
Using npm
`sh
$ npm install --save @lilanjun/react-contexify
`
The gist
`js
import React from 'react';
import { Menu, Item, Separator, Submenu, MenuProvider, useContextMenu } from 'react-contexify';
import 'react-contexify/dist/ReactContexify.css';
const MENU_ID = 'blahblah';
function App() {
const { show } = useContextMenu({
id: MENU_ID,
});
function handleContextMenu(event){
event.preventDefault();
show(event, {
props: {
key: 'value'
}
})
}
const handleItemClick = ({ event, props }) => console.log(event,props);
return (
lorem ipsum blabladhasi blaghs blah
);
}
``