Skip to content

Commit 9681162

Browse files
authored
Documentation edits made through Mintlify web editor
1 parent d164fde commit 9681162

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

react-components.mdx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,26 @@ And the component will be rendered as a React component in the MDX file.
4444

4545
<Counter />
4646

47+
## Importing Components
48+
49+
Just like in regular React, you can import components from other files.
50+
51+
```jsx
52+
import { ColorGenerator } from "/snippets/color-generator.mdx"
53+
```
54+
55+
<Warning>
56+
But unlike regular React, you can't import components from every MDX file. Re-usable components can only be referenced from MDX files within the `snippets` folder.
57+
</Warning>
58+
59+
After importing the component, you can use it in your MDX files like this:
60+
61+
```jsx
62+
<ColorGenerator />
63+
```
64+
65+
Learn more about [reusable snippets](/reusable-snippets).
66+
4767
### Complex Example
4868

4969
You can also build much more complex components. Here's an example of a color generator component that uses multiple React hooks:
@@ -171,26 +191,6 @@ And the component will be rendered as a React component in the MDX file.
171191

172192
<ColorGenerator />
173193

174-
## Importing Components
175-
176-
Just like in regular React, you can import components from other files.
177-
178-
```jsx
179-
import { ColorGenerator } from "/snippets/color-generator.mdx"
180-
```
181-
182-
<Warning>
183-
But unlike regular React, you can't import components from every MDX file. Re-usable components can only be referenced from MDX files within the `snippets` folder.
184-
</Warning>
185-
186-
After importing the component, you can use it in your MDX files like this:
187-
188-
```jsx
189-
<ColorGenerator />
190-
```
191-
192-
Learn more about [reusable snippets](/reusable-snippets).
193-
194194
## Considerations
195195

196196
<AccordionGroup>

0 commit comments

Comments
 (0)