React components are a powerful way to create interactive and reusable elements in your documentation. You can use React directly in your MDX files without any additional setup.Documentation Index
Fetch the complete documentation index at: https://mintlify-sam-fix-thumbnails.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Using React Components
You can build components directly in your MDX files using React hooks.Basic Example
Here’s a basic example of a counter component:Counter component can then be used in your MDX files like this:
Importing Components
Just like in regular React, you can import components from other files.Complex Example
You can also build much more complex components. Here’s an example of a color generator component that uses multiple React hooks:/snippets/color-generator.jsx
Considerations
Client-Side Rendering Impact
Client-Side Rendering Impact
React hook components render on the client-side, which has several implications:
- SEO: Search engines might not fully index dynamic content
- Initial Load: Visitors may experience a flash of loading content before components render
- Accessibility: Ensure dynamic content changes are announced to screen readers
Performance Best Practices
Performance Best Practices
- Optimize Dependency Arrays: Include only necessary dependencies in your
useEffectdependency arrays - Memoize Complex Calculations: Use
useMemooruseCallbackfor expensive operations - Reduce Re-renders: Break large components into smaller ones to prevent cascading re-renders
- Lazy Loading: Consider lazy loading complex components to improve initial page load time