diff --git a/docusaurus/docs/adding-images-fonts-and-files.md b/docusaurus/docs/adding-images-fonts-and-files.md index 3489670e705..0744f597527 100644 --- a/docusaurus/docs/adding-images-fonts-and-files.md +++ b/docusaurus/docs/adding-images-fonts-and-files.md @@ -51,12 +51,15 @@ One way to add SVG files was described in the section above. You can also import ```js import { ReactComponent as Logo } from './logo.svg'; -const App = () => ( -
- {/* Logo is an actual React component */} - -
-); + +function App() { + return ( +
+ {/* Logo is an actual React component */} + +
+ ); +} ``` 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. diff --git a/packages/cra-template-typescript/template/src/App.tsx b/packages/cra-template-typescript/template/src/App.tsx index eb557394f87..a53698aab3c 100644 --- a/packages/cra-template-typescript/template/src/App.tsx +++ b/packages/cra-template-typescript/template/src/App.tsx @@ -2,7 +2,7 @@ import React from 'react'; import logo from './logo.svg'; import './App.css'; -const App = () => { +function App() { return (