HotupdaterHot Updater
React Native API

init

`HotUpdater.init` initializes HotUpdater for manual update flows without wrapping a React component.

Usage

Use HotUpdater.init when you want a fully custom update flow and cannot, or do not want to, wrap your root component with HotUpdater.wrap. Call it once when your runtime considers the app ready. This API exists for apps that only need Hot Updater initialization and do not need the extra React HOC created by manual HotUpdater.wrap.

HotUpdater.init is equivalent to HotUpdater.wrap({ updateMode: "manual" })(App) without the HOC.

import { HotUpdater } from "@hot-updater/react-native";

HotUpdater.init({
  baseURL: "<your-update-server-url>",
  requestHeaders: {
    Authorization: "Bearer <your-access-token>",
  },
});

After initialization, call HotUpdater.checkForUpdate() wherever your runtime or app state says it is safe to check.

const updateInfo = await HotUpdater.checkForUpdate({
  updateStrategy: "appVersion",
});

if (!updateInfo) {
  return;
}

await updateInfo.updateBundle();

if (updateInfo.shouldForceUpdate) {
  await HotUpdater.reload();
}

Configuration Reference

OptionTypeRequiredDescription
baseURLstringYesYour update server URL
requestHeadersRecord<string, string>NoShared headers used by update checks and app-ready notifications
requestTimeoutnumberNoRequest timeout in milliseconds (default: 5000)
onNotifyAppReady(result) => voidNoCallback invoked after native app-ready state is read

When to Use init

Use HotUpdater.init when another runtime owns the root component, when you need to initialize before rendering, or when your app has a custom shell that does not make a root HOC convenient.

Use HotUpdater.wrap when you want Hot Updater to manage the root component lifecycle directly, especially for automatic update checks with a fallback UI.

On this page