Skip to content

Instantly share code, notes, and snippets.

@estebanmunchjones2019
Last active March 30, 2021 10:08
Show Gist options
  • Save estebanmunchjones2019/5423d6c797ba7a85216e5f3df156a55c to your computer and use it in GitHub Desktop.
Save estebanmunchjones2019/5423d6c797ba7a85216e5f3df156a55c to your computer and use it in GitHub Desktop.
import '../styles/globals.css'
import Layout from '../components/layout'
function MyApp({ Component, pageProps }) {
return (
<div>
<Layout>
{/* <Component /> represents each route's content */}
<Component {...pageProps} />
</Layout>
</div>
)
}
export default MyApp
export default function Home() {
return (
<>
<h1>This is the Home page</h1>
<h2>This is the Next demo</h2>
<h2>If you right click on this app, and choose 'View Page Source', you'll see that the HTML content includes this paragraph.</h2>
</>
)
}
import Link from 'next/link';
import styles from './Layout.module.css';
export default function Layout({children}){
return (
<div className={styles.Layout}>
{/* Navbar start */}
<nav>
<ul className={styles['nav-ul']}>
<li className={styles['nav-li']}>
<Link href="/"><a>Home</a></Link>
</li>
<li className={styles['nav-li']}>
<Link href="/about"><a>About</a></Link>
</li>
<li className={styles['nav-li']}>
<Link href="/contact"><a>Contact</a></Link>
</li>
</ul>
</nav>
{/* Navbar end */}
{/* each route content is rendered below */}
{children}
</div>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment