Installation Methods
Choose the method that best fits your setup:CDN Script
Quick setup with a script tag
NPM Package
Install as a development dependency
HTML Script
Add directly to your HTML file
Dynamic Import
Import conditionally in JavaScript
CDN Script
The fastest way to add React Grab to any project:index.html
NPM Package
For projects with a module bundler:HTML Script
For static HTML files or simple setups without build tools:index.html
This method uses hostname detection to determine if you’re in development. Adjust the condition based on your setup.
Dynamic Import
For advanced setups with custom module loading:src/index.tsx
Environment Detection
Different frameworks and build tools use different methods to detect the environment:Framework-Specific Guides
For detailed instructions on supported frameworks:Next.js
App Router and Pages Router integration
Vite
Vite-based React projects
Webpack
Webpack-based React projects
TanStack Start
TanStack Start integration
Unsupported Frameworks
React Grab currently doesn’t have automatic setup for:- Remix: Manual CDN script in
root.tsx - Astro: Manual script in layout component
- Gatsby: Manual plugin or HTML script
- SvelteKit: Not applicable (Svelte-specific)
Verification Steps
After manual installation, verify React Grab is working:Test the copy feature
- Hover over any UI element
- Press ⌘C (Mac) or Ctrl+C (Windows/Linux)
- Check your clipboard for the copied context:
Common Issues
React Grab not loading
React Grab not loading
Check the environment condition: Make sure your development environment check is correct:Check the browser console: Look for any error messages related to loading React Grab.
CORS errors with CDN
CORS errors with CDN
If you see CORS errors when loading from unpkg.com:
- Ensure you’re using
crossOrigin="anonymous"on the script tag - Try using
https://instead of//in the CDN URL - Consider using the NPM package method instead
Module not found errors
Module not found errors
If you see “Cannot find module ‘react-grab’”:
- Install the package:
npm install react-grab - Restart your development server
- Clear any build cache
Loading in production builds
Loading in production builds
If React Grab is loading in production:
- Verify your environment check is correct
- Ensure your build tool is configured to replace environment variables
- Check that tree-shaking is enabled in your bundler
TypeScript errors
TypeScript errors
If you get TypeScript errors:Or add a type declaration:
src/react-grab.d.ts
Advanced Configuration
For advanced use cases, you can configure React Grab programmatically:src/index.tsx
See the Configuration API for all available options.
Need Help?
If you’re having trouble with manual installation:- Check the troubleshooting guide
- Search existing GitHub issues
- Ask in the Discord community
- Open a new issue with your setup details
Next Steps
Connect to Agent
Set up React Grab with your AI coding assistant
Configure Options
Customize activation keys and behavior
