docs: add import React statement in JSX file example (#7050)

This commit is contained in:
Kayce Basques 2022-03-28 18:30:35 -07:00 committed by GitHub
parent b5fc9a6b6d
commit e31e91ef47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -110,6 +110,8 @@ The `@site` alias points to your website's directory, usually where the `docusau
While declaring components within Markdown is very convenient for simple cases, it becomes hard to maintain because of limited editor support, risks of parsing errors, and low reusability. Use a separate `.js` file when your component involves complex JS logic:
```jsx title="src/components/Highlight.js"
import React from 'react';
export default function Highlight({children, color}) {
return (
<span