Create a React Project with useDapp
Let's set up a new React project and install dependencies, which we can create within our Hardhat project's folder without much issue. The create-react-app
package will create a new frontend
directory for us:
If you remember, Ethers.js is a library that assists with JSON-RPC communication. The useDApp package is a similar library that uses Ethers.js and formats them into React hooks so that they work better in frontend projects. We've also added two MUI packages for styling and components.
Let's set up the App.js
file located in the frontend/src
directory to add some visual structure:
You can start the React project by running the following command from within the frontend
directory:
Note
At this point, you may see a couple compilation warnings, but as we continue to build the DApp, we'll make changes that will resolve the warnings.
Your frontend will be available at localhost:3000.
At this point, our frontend project is set up well enough to start working on the functional code!
Last updated