-
Notifications
You must be signed in to change notification settings - Fork 26.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The current TypeScript "with-typescript" looks like it was put there …
…as a place holder. I'm fairly new to TypeScript but I'm sure the changes I've made here will be a huge improvement. Open to suggestions and to update as appropriate. Also, Tried to run yarn lint --fix to no avail. I can't figure out how to get it to find lint whether I'm running on my mac or PC. I tried lots of variations around npm i lint -g but had no success. (#6011)
- Loading branch information
1 parent
f9b98e6
commit 3a3347d
Showing
7 changed files
with
74 additions
and
16 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as React from "react" | ||
import ListItem from './ListItem' | ||
|
||
export interface DataObject { | ||
id: number, | ||
name: string | ||
} | ||
|
||
const List : React.FunctionComponent = () => { | ||
const dataArray : DataObject[] = | ||
[{id: 101, name: 'larry'}, {id: 102, name: 'sam'}, {id: 103, name: 'jill'}] | ||
return ( | ||
<ul> | ||
{dataArray.map(item => ( | ||
<li key={item.id}> | ||
<ListItem data={item}/> | ||
</li> | ||
))} | ||
</ul> | ||
) | ||
} | ||
|
||
export default List; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import * as React from 'react' | ||
import {DataObject} from "./List"; | ||
|
||
export interface Props { | ||
data: DataObject | ||
} | ||
|
||
const ListItem: React.FunctionComponent<Props> = ({ data }) => ( | ||
<React.Fragment>{data.id}:{data.name}</React.Fragment> | ||
); | ||
|
||
export default ListItem; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import * as React from "react" | ||
import Link from 'next/link' | ||
import Layout from '../components/Layout'; | ||
|
||
export default () => ( | ||
const about : React.FunctionComponent = () => ( | ||
<Layout title="About | Next.js + TypeScript Example"> | ||
<p>This is the about page</p> | ||
<p><Link href='/'><a>Go home</a></Link></p> | ||
</Layout> | ||
) | ||
) | ||
|
||
export default about; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
import * as React from "react" | ||
import Link from 'next/link' | ||
import Layout from '../components/Layout'; | ||
import Layout from '../components/Layout' | ||
|
||
export default () => ( | ||
<Layout title="Home | Next.js + TypeScript Example"> | ||
<h1>Hello Next.js 👋</h1> | ||
<p><Link href='/about'><a>About</a></Link></p> | ||
</Layout> | ||
) | ||
const index : React.FunctionComponent = () => { | ||
return ( | ||
<Layout title="Home | Next.js + TypeScript Example"> | ||
<h1>Hello Next.js 👋</h1> | ||
<p><Link href='/about'><a>About</a></Link></p> | ||
</Layout> | ||
) | ||
} | ||
|
||
export default index; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import * as React from "react" | ||
import Layout from '../components/Layout' | ||
import List from '../components/List' | ||
|
||
const list : React.FunctionComponent = () => ( | ||
<Layout title="About | Next.js + TypeScript Example"> | ||
<List/> | ||
</Layout> | ||
) | ||
|
||
export default list; |