Lesson 4 of 11
OTA Updates - Expo Updates
OTA (Over-The-Air) updates let you ship JavaScript and asset changes to users without going through App Store/Play Store review. Critical bug fixes that previously took 3-7 days can ship in minutes. Expo Updates supports this natively.
Expo Updates Setup
npx expo install expo-updates
eas update:configure
# app.config.ts - specify update channel
ios: { runtimeVersion: '1.0.0' },
android: { runtimeVersion: '1.0.0' },
updates: {
url: 'https://u.expo.dev/YOUR_PROJECT_ID',
enabled: true,
checkAutomatically: 'ON_LOAD', // check for update every app start
fallbackToCacheTimeout: 5000, // use cached bundle if update check takes > 5s
codeSigningCertificate: './keys/certificate.pem', // sign updates for security
},
# Publish an update:
eas update --channel production --message "Fix login crash"
# List updates:
eas update:list
# Roll back:
eas update:roll-back --channel productionCustom Update Check
import * as Updates from 'expo-updates';
import { useState, useEffect } from 'react';
export function useOTAUpdate() {
const [updateAvailable, setUpdateAvailable] = useState(false);
const [isUpdating, setIsUpdating] = useState(false);
useEffect(() => {
if (__DEV__) return; // never check in dev
checkForUpdate();
}, []);
async function checkForUpdate() {
try {
const result = await Updates.checkForUpdateAsync();
if (result.isAvailable) setUpdateAvailable(true);
} catch (err) {
// Network error - ignore
}
}
async function applyUpdate() {
setIsUpdating(true);
try {
await Updates.fetchUpdateAsync();
// Reload only after user confirms (critical fix) or in background
await Updates.reloadAsync();
} catch (err) {
setIsUpdating(false);
}
}
return { updateAvailable, isUpdating, applyUpdate };
}
// ---- Update prompt component ----
function UpdateBanner() {
const { updateAvailable, isUpdating, applyUpdate } = useOTAUpdate();
if (!updateAvailable) return null;
return (
<View style={{ backgroundColor: '#1e3a5f', padding: 16, flexDirection: 'row', alignItems: 'center', gap: 12 }}>
<Text style={{ flex: 1, color: 'white', fontSize: 14 }}>
🚀 A new version is available
</Text>
<Pressable onPress={applyUpdate} disabled={isUpdating} style={{ backgroundColor: '#229c6b', paddingHorizontal: 16, paddingVertical: 8, borderRadius: 8 }}>
<Text style={{ color: 'white', fontWeight: '700' }}>{isUpdating ? 'Updating...' : 'Update Now'}</Text>
</Pressable>
</View>
);
}Tip
Tip
Practice OTA Updates Expo Updates in small, isolated examples before integrating into larger projects. Breaking concepts into small experiments builds genuine understanding faster than reading alone.
Publishing instant JS and asset hotfixes without waiting for App Store review
Practice Task
Note
Practice Task - (1) Write a working example of OTA Updates Expo Updates from scratch without looking at notes. (2) Modify it to handle an edge case (empty input, null value, or error state). (3) Share your solution in the Priygop community for feedback.
Quick Quiz
Common Mistake
Warning
A common mistake with OTA Updates Expo Updates is skipping edge case testing - empty inputs, null values, and unexpected data types. Always validate boundary conditions to write robust, production-ready react native code.
Finished this lesson?