Add basic components

This commit is contained in:
Kamran Ahmed
2019-08-24 18:44:29 +04:00
parent 8c77a26627
commit b351edfa20
4 changed files with 29 additions and 6 deletions

View File

@ -0,0 +1,15 @@
import Link from 'next/link';
const Header = () => (
<div>
<Link href="/">
<a title="Homepage">Home</a>
</Link>
&nbsp; |&nbsp;
<Link href="/about">
<a title="About Page">About Page</a>
</Link>
</div>
);
export default Header;

View File

@ -1,9 +1,10 @@
import React from 'react'; import React from 'react';
import Link from 'next/link'; import Header from '../components/header';
export default function About() { export default function About() {
return ( return (
<div> <div>
<Header />
<p>This is the about page</p> <p>This is the about page</p>
</div> </div>
); );

10
pages/home.js Normal file
View File

@ -0,0 +1,10 @@
import Header from '../components/header';
export const Home = (props) => (
<div>
<Header />
<p>Hello Next.js</p>
</div>
);
export default Home;

View File

@ -1,12 +1,9 @@
import React from 'react'; import React from 'react';
import Link from 'next/link'; import Home from './home';
const Index = () => ( const Index = () => (
<div> <div>
<Link href="/about"> <Home />
<a title="About Page">About Page</a>
</Link>
<p>Hello Next.js</p>
</div> </div>
); );