React is Global: React, ReactDOM, and hooks (e.g., React.useState) are pre-loaded. Do not use import React from 'react';.
Component Definition: Define your React component. The const MyComponent = () => ; style is currently recommended for best reliability in this previewer.
Render by Last Expression: To render your component, ensure its name is the final expression in your snippet (e.g., after defining MyComponent, add MyComponent; on the last line).
Alternative - Direct Render: You can call ReactDOM.render(<YourComponent />, document.getElementById('react-root')); directly in your snippet. If so, the "last expression" rule is not needed.
No Module Exports: Do not use export default MyComponent;.
Styling: Tailwind CSS (CDN) and your app's theme variables (e.g., text-primary) are applied.
Project Component Imports: Direct import of project components (like ShadCN UI) is not supported. Define components within the snippet or use standard HTML styled with Tailwind.
Loading preview environment...