Overview
Dynamic strings allow you to update your web app’s text content instantly without deploying new code. Change marketing copy, fix typos, run time-sensitive campaigns, or adjust messaging—all from the Stringboot Dashboard.Key Benefits
Instant Updates
Change text content without code deploys
Offline-First
Strings cached in IndexedDB—works offline
React Hooks
useString for automatic updatesZero Dependencies
Lightweight 6.6 kB gzipped SDK
Quick Start
1. Add String to Dashboard
Go to Stringboot Dashboard → Strings → Add New String:- Key:
welcome_message - Value:
"Welcome to our app!" - Language:
en
2. Use in Your App
- React Hooks (Recommended)
- Vanilla JavaScript
- TypeScript
Component.jsx
3. Update from Dashboard
Go to Strings → Editwelcome_message → Change to "Welcome back!" → Save
Your app automatically shows the new text next time it syncs.
String Retrieval Methods
1. React Hooks (Recommended)
useString - Single String
- Automatically updates when language changes
- Updates when network sync completes
- Zero boilerplate
useStrings - Multiple Strings
- Fetch multiple strings efficiently
- Single hook for all strings in component
- Returns object with key-value pairs
2. Vanilla JavaScript
Get String (Async)
Watch for Changes (Reactive)
- Automatically updates when string changes
- Perfect for vanilla JS apps
- Lifecycle management needed
3. Get Multiple Strings
Advanced Patterns
String Templates with Formatting
Dashboard String:Manual Sync
Trigger a manual sync to get latest strings:Clear Cache
React Patterns
Component with Loading State
Dynamic Content
Lists
Next.js Patterns
App Router (Server Components)
app/product/[id]/page.tsx
App Router (Client Components)
Best Practices
Use React Hooks in React Apps
Use React Hooks in React Apps
Recommended:Avoid:Hooks handle updates and lifecycle automatically.
Batch String Requests
Batch String Requests
Recommended:Avoid:Single hook is more efficient.
Unwatch When Component Unmounts
Unwatch When Component Unmounts
Vanilla JS:React hooks handle this automatically.
Common Use Cases
Marketing Campaigns
CampaignBanner.jsx
Seasonal Content
- December: “Happy Holidays!”
- January: “Happy New Year!”
- Spring: “Spring Sale!”
Fix Typos Instantly
Found a typo? Fix it in the dashboard and users see the correction immediately on next page load.Next Steps
Translations
Multi-language support and switching
A/B Testing
Optimize messaging with experiments
React Hooks
Complete hooks reference
API Reference
Core Methods
| Method | Description | Returns |
|---|---|---|
get(key, lang?) | Get string asynchronously | Promise<string> |
getMultiple(keys, lang?) | Get multiple strings | Promise<Record<string, string>> |
watch(key, callback) | Watch for changes | void |
unwatch(key) | Stop watching | void |
sync() | Manual sync with server | Promise<void> |
clearCache() | Clear local cache | void |
React Hooks
| Hook | Description | Returns |
|---|---|---|
useString(key) | Get single string | string |
useStrings(keys) | Get multiple strings | Record<string, string> |
useSync() | Manual sync control | { sync, syncing } |
Troubleshooting
Strings not updating
Strings not updating
Check:
- Is SDK initialized?
- Did you call
sync()after dashboard update? - Check browser DevTools → Network for API calls
React hooks not working
React hooks not working
Check:
- Did you initialize SDK with
useStringBootat app root? - Is component inside the initialized app tree?
App.jsx