This is the second chapter of the tutorial on building an end-to-end dapp on Aptos where you have already created a smart contract and are now setting up a React app.
We will use the react
library to build the client side with Create React App.
For the UI, we will use Ant Design. This is just a personal decision; you are welcome to use any different UI library/framework you wish.
In the root folder of the my-first-dapp
project, run:
npx create-react-app client --template typescript
That will create a new client
folder in the current path:
Your file structure should look something like:
Run: cd client
Run: npm start
At this point you should have your app running on http://localhost:3000, which displays the default React layout.
In the client/src
directory, find all the React app files. Letβs clean it up a bit.
Open the App.tsx
file and update its content to be:
function App() { return My app goes here;}export default App;
Once you save the changes, you should see that the app content has changed in the browser and displays My app goes here
.
App.tsx
file and remove the import './App.css';
and import logo from './logo.svg';
lines. Since we remove the default imports on this file, we can remove some files in our project. Delete the files App.css
and logo.svg
.index.tsx
file and remove the import './index.css';
line at the top of the file. Now you can also delete the src/index.css
file.First we will build the dapp UI layout. We have two UI states for the app:
We will use the Ant Design library for our UI: