Member-only story
How To Create A Context Menu With React Hooks.
By the end of this article you will create your own context menu with React Hooks.
Create A New React Project
To create a new application we will use Create React App. In order to do it you’ll need to have Node ≥ 8.10 and npm ≥ 5.6 installed on your machine.
Run the following command in your command line:
npx create-react-app react-context-menu
After running the command open the created folder and run npm start:
cd react-context-menu
npm start
You will see the following:
Menu Containers
Since we want to have multiple menus at the same let’s create some simple containers to keep them.
Let’s create components
folder inside src
folder. Inside that folder we will create another folder called Container
wich is responsible for keeping our container component. Inside this folder let’s add index.jsx
and index.css
files.
You should have the following structure: