Disable Right Click in React.JS
问题 How to disable right click in canvas in ReactJS. Here is what I tried which is still not working: let Canvas = <canvas onContextMenu={(e)=> {e.preventDefault(); return false;}} height={500} width={500} ref="canvas"/>; A warning is also shown in browser console. Warning: Returning false from an event handler is deprecated and will be ignored in a future release. Instead, manually call e.stopPropagation() or e.preventDefault(), as appropriate. EDIT: Yes it did stop the right click functionality