Skip to content
Discussion options

You must be logged in to vote

To add a context menu:
1. In src/components/Desktop.js, add a useState for menu visibility:
javascript<br>const [menu, setMenu] = useState({ open: false, x: 0, y: 0 });<br>const handleContextMenu = (e) => {<br> e.preventDefault();<br> setMenu({ open: true, x: e.clientX, y: e.clientY });<br>};<br>
2. Render a menu component at menu.x, menu.y.
3. Test with npm run dev.
4. Submit a pull request.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Ziqian-Huang0607
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants