Offer alternative versions based on ratings
If a user doesn't like your feature (version 1), automatically show them the improved version 2.
Here's the magic: check their previous rating, show better version if they didn't like v1:
1function ExportFeature() {
2 const { review, getUserRating } = useVibeReview();
3 const [version, setVersion] = useState('v1');
4
5 // Check if user didn't like v1
6 useEffect(() => {
7 getUserRating('export-pdf', { version: 'v1' }).then(rating => {
8 if (rating && rating.rating <= 2) {
9 setVersion('v2'); // Switch to better version!
10 }
11 });
12 }, []);
13
14 const handleExport = async () => {
15 // Use the right version
16 if (version === 'v1') {
17 await exportToPDFV1();
18 } else {
19 await exportToPDFV2(); // ⨠Improved!
20 }
21
22 // Ask for feedback
23 await review('export-pdf', { version });
24 };
25
26 return (
27 <button onClick={handleExport}>
28 đ Export {version === 'v2' && 'â¨'}
29 </button>
30 );
31}version: 'v1' or version: 'v2'