You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The counter renders as an interactive React component.
54
90
55
-
<Warning>
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.
57
-
</Warning>
91
+
<Counter />
58
92
59
-
After importing the component, use it in your `MDX` files like this:
93
+
## Importing components
60
94
61
-
```mdx
62
-
<ColorGenerator />
63
-
```
95
+
You can import components from your `snippets` folder. Unlike regular React, you cannot import components from every `MDX` file. Reusable components must be referenced from files within the `snippets` folder. Learn more about [reusable snippets](/reusable-snippets).
64
96
65
-
Learn more about [reusable snippets](/reusable-snippets).
97
+
### Example
66
98
67
-
### Complex example
99
+
This example declares a `ColorGenerator` component that uses multiple React hooks and then uses it in an `MDX` file.
68
100
69
-
You can build much more complex components. Here is an example of a colorgenerator component that uses multiple React hooks:
101
+
Create `color-generator.jsx` file in the `snippets` folder:
0 commit comments