Skip to content

Commit 2ba4e55

Browse files
committed
Update react-components.mdx
1 parent 087fa4e commit 2ba4e55

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

react-components.mdx

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ icon: "react"
77
import { Counter } from "/snippets/counter.mdx";
88
import { ColorGenerator } from "/snippets/color-generator.jsx";
99

10-
[React components](https://react.dev) are a powerful way to create interactive and reusable elements in your documentation. Use React directly in your MDX files without any additional setup.
10+
[React components](https://react.dev) are a powerful way to create interactive and reusable elements in your documentation.
1111

12-
## Using React Components
12+
You can use React components directly in your `MDX` files without any additional setup.
13+
14+
## Using React components
1315

1416
You can build components directly in your MDX files using [React hooks](https://react.dev/reference/react/hooks).
1517

16-
### Basic Example
18+
### Basic example
1719

18-
Here's a basic example of a counter component:
20+
Here is a basic example of a counter component:
1921

2022
```mdx
2123
export const Counter = () => {
@@ -32,17 +34,17 @@ export const Counter = () => {
3234
}
3335
```
3436

35-
Use the `Counter` component in your MDX files like this:
37+
The `Counter` component can be used in your `MDX` files like this:
3638

3739
```mdx
3840
<Counter />
3941
```
4042

41-
The component renders as an interactive React component in the MDX file.
43+
The counter renders as an interactive React component.
4244

4345
<Counter />
4446

45-
## Importing Components
47+
## Importing components
4648

4749
Just like in regular React, you can import components from other files.
4850

@@ -51,20 +53,20 @@ import { ColorGenerator } from "/snippets/color-generator.jsx"
5153
```
5254

5355
<Warning>
54-
Unlike regular React, you can't import components from every MDX file. Reusable components can only be referenced from MDX files within the `snippets` folder.
56+
Unlike regular React, you can't import components from every `MDX` file. Reusable components can only be referenced from `MDX` files within the `snippets` folder.
5557
</Warning>
5658

57-
After importing the component, use it in your MDX files like this:
59+
After importing the component, use it in your `MDX` files like this:
5860

5961
```mdx
6062
<ColorGenerator />
6163
```
6264

6365
Learn more about [reusable snippets](/reusable-snippets).
6466

65-
### Complex Example
67+
### Complex example
6668

67-
You can build much more complex components. Here's an example of a color generator component that uses multiple React hooks:
69+
You can build much more complex components. Here is an example of a color generator component that uses multiple React hooks:
6870

6971
```mdx /snippets/color-generator.jsx [expandable]
7072
export const ColorGenerator = () => {
@@ -179,30 +181,30 @@ export const ColorGenerator = () => {
179181
}
180182
```
181183

182-
Use the above component in your MDX files like this:
184+
The `ColorGenerator` component can be used in your `MDX` files like this:
183185

184186
```mdx
185187
<ColorGenerator />
186188
```
187189

188-
The component renders as an interactive React component in the MDX file.
190+
The color generator renders as an interactive React component.
189191

190192
<ColorGenerator />
191193

192194
## Considerations
193195

194196
<AccordionGroup>
195-
<Accordion title="Client-Side Rendering Impact">
197+
<Accordion title="Client-side rendering impact">
196198
React hook components render on the client-side, which has several implications:
197199

198-
- **SEO**: Search engines might not fully index dynamic content
199-
- **Initial Load**: Visitors may experience a flash of loading content before components render
200-
- **Accessibility**: Ensure dynamic content changes are announced to screen readers
200+
- **SEO**: Search engines might not fully index dynamic content.
201+
- **Initial load**: Visitors may experience a flash of loading content before components render.
202+
- **Accessibility**: Ensure dynamic content changes are announced to screen readers.
201203
</Accordion>
202-
<Accordion title="Performance Best Practices">
203-
- **Optimize dependency arrays**: Include only necessary dependencies in your `useEffect` dependency arrays
204-
- **Memoize complex calculations**: Use `useMemo` or `useCallback` for expensive operations
205-
- **Reduce re-renders**: Break large components into smaller ones to prevent cascading re-renders
206-
- **Lazy loading**: Consider lazy loading complex components to improve initial page load time
204+
<Accordion title="Performance best practices">
205+
- **Optimize dependency arrays**: Include only necessary dependencies in your `useEffect` dependency arrays.
206+
- **Memoize complex calculations**: Use `useMemo` or `useCallback` for expensive operations.
207+
- **Reduce re-renders**: Break large components into smaller ones to prevent cascading re-renders.
208+
- **Lazy loading**: Consider lazy loading complex components to improve initial page load time.
207209
</Accordion>
208210
</AccordionGroup>

0 commit comments

Comments
 (0)