Skip to content

Commit

Permalink
[Examples] Removed React.FC/FunctionComponent from with-typescript (v…
Browse files Browse the repository at this point in the history
…ercel#13798)

Related to [this](facebook/create-react-app#8177).

Let me know if you want me to change something.
  • Loading branch information
todortotev authored and rokinsky committed Jul 11, 2020
1 parent bd579b0 commit bd0f616
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
8 changes: 3 additions & 5 deletions examples/with-typescript/components/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import * as React from 'react'
import React, { ReactNode } from 'react'
import Link from 'next/link'
import Head from 'next/head'

type Props = {
children?: ReactNode
title?: string
}

const Layout: React.FunctionComponent<Props> = ({
children,
title = 'This is the default title',
}) => (
const Layout = ({ children, title = 'This is the default title' }: Props) => (
<div>
<Head>
<title>{title}</title>
Expand Down
2 changes: 1 addition & 1 deletion examples/with-typescript/components/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type Props = {
items: User[]
}

const List: React.FunctionComponent<Props> = ({ items }) => (
const List = ({ items }: Props) => (
<ul>
{items.map((item) => (
<li key={item.id}>
Expand Down
4 changes: 1 addition & 3 deletions examples/with-typescript/components/ListDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ type ListDetailProps = {
item: User
}

const ListDetail: React.FunctionComponent<ListDetailProps> = ({
item: user,
}) => (
const ListDetail = ({ item: user }: ListDetailProps) => (
<div>
<h1>Detail for {user.name}</h1>
<p>ID: {user.id}</p>
Expand Down
4 changes: 2 additions & 2 deletions examples/with-typescript/components/ListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react'
import React from 'react'
import Link from 'next/link'

import { User } from '../interfaces'
Expand All @@ -7,7 +7,7 @@ type Props = {
data: User
}

const ListItem: React.FunctionComponent<Props> = ({ data }) => (
const ListItem = ({ data }: Props) => (
<Link href="/users/[id]" as={`/users/${data.id}`}>
<a>
{data.id}: {data.name}
Expand Down

0 comments on commit bd0f616

Please sign in to comment.