# React Custom Hook Example πŸͺ A reusable hook for local storage management. ```typescript import { useState, useEffect } from 'react'; function useLocalStorage<T>(key: string, initialValue: T) { const [storedValue, setStoredValue] = useState<T>(() => { try { const item = window.localStorage.getItem(key); return item ? JSON.parse(item) : initialValue; } catch (error) { return initialValue; } }); const setValue = (value: T | ((val: T) => T)) => { const ...
Popular
πŸ’»

Code Snippet

Share beautiful code screenshots

# How to Center a Div? 🎯 **User:** How do I center a div in CSS in 2024? **AI:** Great question! Here are the modern approaches: ## 1. Flexbox (Most Common) ```css .parent { display: flex; justify-content: center; align-items: center; } ``` ## 2. Grid (Cleanest) ```css .parent { display: grid; place-items: center; } ``` ## 3. Container Queries (New!) ```css .parent { container-type: inline-size; } .child { margin-inline: auto; } ``` > πŸ’‘ **Pro tip:** Flexbox is the most wide...
Popular
πŸ€–

AI Conversation

Share AI chat screenshots

# User Registration Flow πŸ“ ```mermaid flowchart TD A[🏠 Landing Page] --> B{Has Account?} B -->|Yes| C[πŸ” Login] B -->|No| D[πŸ“ Sign Up] D --> E[πŸ“§ Email Verification] E --> F{Verified?} F -->|Yes| G[βœ… Welcome!] F -->|No| H[πŸ”„ Resend Email] H --> E C --> I{Valid?} I -->|Yes| G I -->|No| J[❌ Error] J --> C ``` ## Key Steps | Step | Action | Time | |------|--------|------| | Sign Up | Fill form | 30s | | Verify | Check email | 1min | | Login | En...
New
πŸ“Š

Flowchart

Create flow diagrams with Mermaid

# AI Code Assistants Comparison πŸ€– | Feature | GitHub Copilot | Cursor | Claude Code | |---------|---------------|--------|-------------| | **Price** | $10/mo | $20/mo | $20/mo | | **IDE Support** | All major | VSCode fork | CLI | | **Model** | GPT-4 | Multiple | Claude 3.5 | | **Offline** | ❌ | ❌ | ❌ | | **Context** | Good | Excellent | Excellent | | **Speed** | ⚑ Fast | ⚑ Fast | 🐒 Slower | ## Verdict - **Best for beginners:** GitHub Copilot - **Best for power users:** Cursor - **Best for c...
Free
πŸ“‹

Comparison Table

Compare products or features

# Deploy to Vercel in 60 Seconds ⚑ ## Prerequisites - A GitHub account - A project with `package.json` ## Steps ### 1. Push to GitHub ```bash git init git add . git commit -m "Initial commit" git push -u origin main ``` ### 2. Connect Vercel 1. Go to [vercel.com](https://vercel.com) 2. Click **"New Project"** 3. Import your GitHub repo 4. Click **"Deploy"** ### 3. Done! πŸŽ‰ Your site is live at: `your-project.vercel.app` ## Bonus: Custom Domain ``` vercel domains add yourdomain.com ``` > ...
Free
πŸ“š

Mini Tutorial

Create quick how-to guides

# What's New in v2.0 πŸš€ ## ✨ New Features ### AI-Powered Suggestions Our new AI engine provides smarter recommendations based on your usage patterns. ### Dark Mode Finally! Toggle between light and dark themes. ``` Settings β†’ Appearance β†’ Dark Mode ``` ### Export to PDF Export your work directly to PDF with one click. ## πŸ› Bug Fixes - Fixed login issues on Safari - Improved performance on large files - Better error messages ## πŸ“Š Stats | Metric | Before | After | |--------|--------|---...
New
πŸ“°

Changelog

Announce product updates