Last active
October 24, 2021 00:58
-
-
Save ximxim/8c0f1d520aaad3c2705c8b6fb09d0ffb to your computer and use it in GitHub Desktop.
Starting point of NFT minting project front end
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { NextPage } from "next"; | |
import Head from "next/head"; | |
import { useState, useCallback, useEffect } from "react"; | |
import styles from "../styles/Home.module.css"; | |
const Home: NextPage = () => { | |
/** | |
* comments state will be used as console log | |
*/ | |
const [comments, setComments] = useState<string[]>(["Initialized"]); | |
/** | |
* handleAddComment will be used in place of console.log | |
*/ | |
const handleAddComment = useCallback((comment: string, ...args: any[]) => { | |
console.log(comment, args); | |
setComments((prevState) => [...prevState, comment]); | |
}, []); | |
useEffect(() => { | |
/** | |
* placeholder to trigger Metamask connection on mount | |
*/ | |
handleAddComment('Ready to code.'); | |
}, []); | |
return ( | |
<div className={styles.container}> | |
<Head> | |
<title>Create Next App</title> | |
<meta name="description" content="Generated by create next app" /> | |
<link rel="icon" href="/favicon.ico" /> | |
</Head> | |
<main className={styles.main}> | |
<h1 className={styles.title}> | |
Welcome to <a href="https://nextjs.org">NFT Minting Example</a> | |
</h1> | |
<div className={styles.grid}> | |
<a href="#" className={styles.card} style={{ width: '100%' }}> | |
<h2>Mint Basic NFT</h2> | |
<ul> | |
{comments.map((comment, index) => ( | |
<li key={index}>{comment}</li> | |
))} | |
</ul> | |
</a> | |
</div> | |
</main> | |
</div> | |
); | |
}; | |
export default Home; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment