Let's start with creating a frontend project using create-react-app.
1
npx create-react-app counter-dapp
Copied!
This command takes a little while to complete, be pertinent. You need to confirm the installation of create-react-app if it's your first time using this command.
Once the command complete, start the web app:
1
cd counter-dapp
2
yarn start
Copied!
A browser window will be opened and who the web app. You can visit http://localhost:3000/ either.
🛠
Add counter state and buttons
We'll add a simple text to show the current value of the counter state.
"Inc" and "Dec" buttons to update the counter state.
Edit src/App.js and set the App() function looks like below: