File tree Expand file tree Collapse file tree 3 files changed +38
-3
lines changed Expand file tree Collapse file tree 3 files changed +38
-3
lines changed Original file line number Diff line number Diff line change 11import React from 'react'
2+ import Link from 'next/link'
23
3- export default ( ) => < h1 > Index Page</ h1 >
4+ export default ( ) => (
5+ < div >
6+ < h1 > Index page</ h1 >
7+
8+ < Link href = "/notes" >
9+ < a > Notes</ a >
10+ </ Link >
11+ </ div >
12+ )
Original file line number Diff line number Diff line change 11import React from 'react'
22import { useRouter } from 'next/router'
3+ import Link from 'next/link'
34
45export default ( ) => {
56 const router = useRouter ( )
67 const { id } = router . query
78
89 return (
9- < h1 > Note: { id } </ h1 >
10+ < div >
11+ < h1 > Note: { id } </ h1 >
12+
13+ < Link href = "/notes" >
14+ < a > Notes</ a >
15+ </ Link >
16+ </ div >
1017 )
1118}
Original file line number Diff line number Diff line change 11import React from 'react'
2+ import Link from 'next/link'
23
3- export default ( ) => < h1 > Notes</ h1 >
4+ export default ( ) => {
5+ const notes = new Array ( 15 ) . fill ( 1 ) . map ( ( e , i ) => ( { id : i , title : `Note: ${ i } ` } ) )
6+
7+ return (
8+ < div >
9+ < h1 > Notes</ h1 >
10+
11+ { notes . map ( note => (
12+ < div >
13+ < Link key = { note . id } href = "/notes/[id]" as = { `/notes/${ note . id } ` } >
14+ < a >
15+ < strong > { note . title } </ strong >
16+ </ a >
17+ </ Link >
18+ </ div >
19+ ) ) }
20+ </ div >
21+ )
22+ }
You can’t perform that action at this time.
0 commit comments