diff --git a/README.md b/README.md index aed8ccc5..c3f4fe0d 100644 --- a/README.md +++ b/README.md @@ -189,10 +189,10 @@ type AppProps = { // Easiest way to declare a Function Component; return type is inferred. const App = ({ message }: AppProps) =>
{message}
; -// you can choose annotate the return type so an error is raised if you accidentally return some other type +// You can choose to annotate the return type so an error is raised if you accidentally return some other type const App = ({ message }: AppProps): React.JSX.Element =>
{message}
; -// you can also inline the type declaration; eliminates naming the prop types, but looks repetitive +// You can also inline the type declaration; eliminates naming the prop types, but looks repetitive const App = ({ message }: { message: string }) =>
{message}
; // Alternatively, you can use `React.FunctionComponent` (or `React.FC`), if you prefer. diff --git a/docs/basic/getting-started/function-components.md b/docs/basic/getting-started/function-components.md index f63f2829..68cf20e0 100644 --- a/docs/basic/getting-started/function-components.md +++ b/docs/basic/getting-started/function-components.md @@ -14,10 +14,10 @@ type AppProps = { // Easiest way to declare a Function Component; return type is inferred. const App = ({ message }: AppProps) =>
{message}
; -// you can choose annotate the return type so an error is raised if you accidentally return some other type +// You can choose to annotate the return type so an error is raised if you accidentally return some other type const App = ({ message }: AppProps): React.JSX.Element =>
{message}
; -// you can also inline the type declaration; eliminates naming the prop types, but looks repetitive +// You can also inline the type declaration; eliminates naming the prop types, but looks repetitive const App = ({ message }: { message: string }) =>
{message}
; // Alternatively, you can use `React.FunctionComponent` (or `React.FC`), if you prefer.