Skip to content

Commit 6598c45

Browse files
Lewis Lloberawombleton
Lewis Llobera
authored andcommitted
Change arrow functions to function declarations (facebook#8412)
- The JavaScript template uses a function declaration to define the component, the TypeScript template and a page of the documentation used arrow functions. Changed it to use function declarations for consistency and readability.
1 parent ce563c0 commit 6598c45

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

docusaurus/docs/adding-images-fonts-and-files.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,15 @@ One way to add SVG files was described in the section above. You can also import
5151

5252
```js
5353
import { ReactComponent as Logo } from './logo.svg';
54-
const App = () => (
55-
<div>
56-
{/* Logo is an actual React component */}
57-
<Logo />
58-
</div>
59-
);
54+
55+
function App() {
56+
return (
57+
<div>
58+
{/* Logo is an actual React component */}
59+
<Logo />
60+
</div>
61+
);
62+
}
6063
```
6164

6265
This is handy if you don't want to load SVG as a separate file. Don't forget the curly braces in the import! The `ReactComponent` import name is significant and tells Create React App that you want a React component that renders an SVG, rather than its filename.

packages/cra-template-typescript/template/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import logo from './logo.svg';
33
import './App.css';
44

5-
const App = () => {
5+
function App() {
66
return (
77
<div className="App">
88
<header className="App-header">

0 commit comments

Comments
 (0)