Implementing the withdraw Function
Learn to create multiple pages inside the application.
We'll cover the following
Creating a new page in Next.js
In the Partnerly app, we’ve implemented the withdrawal functionality on a new page. Creating new pages in Next.js is very simple. We just need to create a new file under the pages
folder with the desired path name for the page. Next.js automatically takes care of the routing to this page. We can call this new file withdraw.js
. Next.js will create a new page at the /withdraw
path.
The withdraw page will share some components with the index page. For example, it will also require the MainButton
and AddressInput
fields. We can create a file called components/index.js
that will contain the shared components. We can export the MainButton
and AddressInput
from this file and import them into the index.js
and withdraw.js
files. We can, in fact, have all the presentational components inside this new file.
The withdraw page will also share functionality with the index page. For example, it would also need to connect to the wallet.
Get hands-on with 1400+ tech skills courses.