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
Create interactive examples and dynamic content in your documentation using familiar [React hooks](https://react.dev/reference/react/hooks).
10
+
[React components](https://react.dev) are a powerful way to create interactive and reusable elements in your documentation.
11
11
12
-
<Note>
13
-
No imports needed! All standard React hooks are automatically available in your MDX files.
14
-
</Note>
12
+
You can use React directly in your MDX files without any additional setup.
15
13
16
-
## Available Hooks
17
14
18
-
You can use all standard React hooks in your documentation, such as `useState`, `useEffect`, and other [React hooks](https://react.dev/reference/react/hooks).
15
+
## Using React Components
19
16
20
-
## Interactive Examples
17
+
You can build components directly in your MDX files using [React hooks](https://react.dev/reference/react/hooks).
21
18
22
-
### Creating Components Directly in MDX
19
+
### Basic Example
23
20
24
-
Create a component directly in your MDX file using React hooks to build interactive elements that respond to user actions:
25
-
26
-
*A basic counter component created with `useState` hook*
Add the component to your MDX content wherever needed:
184
+
After importing the component, you can use it in your MDX files like this:
187
185
188
186
```jsx
189
187
<ColorGenerator />
190
188
```
191
189
192
-
## Important Considerations
190
+
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.
191
+
192
+
Learn more about this limitation in the [reusable snippets](/reusable-snippets) documentation.
0 commit comments