Complete the code to import the EAS Update module in a React Native app.
import [1] from 'expo-updates';
You import the EAS Update module using Updates from expo-updates.
Complete the code to check if a new update is available using EAS Update.
const update = await Updates.[1]();The correct method to check for updates asynchronously is checkForUpdateAsync().
Fix the error in the code to reload the app after an update is downloaded.
if (update.isAvailable) { await Updates.fetchUpdateAsync(); await Updates.[1](); }
The method to reload the app asynchronously is reloadAsync(). Using reload() or others will cause errors.
Fill both blanks to create a function that checks for updates and reloads the app if an update is available.
async function checkAndUpdate() {
const update = await Updates.[1]();
if (update.[2]) {
await Updates.fetchUpdateAsync();
await Updates.reloadAsync();
}
}You use checkForUpdateAsync() to check for updates and isAvailable to see if an update exists.
Fill all three blanks to implement a complete update check, fetch, and reload sequence.
async function performUpdate() {
const update = await Updates.[1]();
if (update.[2]) {
await Updates.[3]();
await Updates.reloadAsync();
}
}First, check for updates with checkForUpdateAsync(). Then, if isAvailable is true, fetch the update with fetchUpdateAsync() before reloading.