React SDK installation
The@syncsnap/react package provides React components and hooks for SyncSnap: upload button, QR code, and job polling.
Install
Peer dependencies
- React
^18.0.0 - Tailwind CSS
^3.0.0or^4.0.0(for component styles)
Backend requirement
The React SDK talks to your backend, not directly to SyncSnap. You must expose:POST /api/syncsnap/job— create jobGET /api/syncsnap/job/:id— get jobGET /api/syncsnap/job/:id/wait— server waits until job completes; returns{ job, result? }GET /api/syncsnap/job/:id/download— get presigned download URL (optional)
Styling
Components use Tailwind and the SDK theme. Add to your global CSS:What’s included
| Export | Purpose |
|---|---|
SyncsnapUploadButton | Button + dialog with QR code; uses useSyncsnapJob internally |
SyncsnapQrCode | QR code only (for custom UI) |
useSyncsnapJob | Hook to create job, poll status, and get download URL |
createUploadUrl | Build the URL to encode in the QR code |