React Native API
setCohort
The `hotUpdater.setCohort()` function overrides the persisted cohort used for rollout decisions.
Usage
Use hotUpdater.setCohort() to move a device into a specific numeric or custom
cohort.
import { hotUpdater } from "./hotUpdater";
function assignQaCohort() {
hotUpdater.setCohort("qa");
console.log(hotUpdater.getCohort()); // "qa"
}Signature
setCohort(cohort: string): voidNumeric cohorts are passed as strings, for example hotUpdater.setCohort("500").
Behavior
- Persists the cohort on the device for future update checks.
- Accepts numeric cohorts in the range
1..1000. - Accepts lowercase slug-style custom cohorts such as
qaandvip-testers. - Normalizes the value before storing it.
- Throws an error when the value is invalid.
Important notes
- Call
hotUpdater.getCohort()first if you need to restore the previous value later. - Partial percentage rollout applies to numeric cohorts. At
100%, a Bundle is also eligible for custom cohorts, even when they are absent fromTarget Cohorts. - To include a custom cohort such as
qaat rollout values below100%, add that value toTarget Cohortsin the console. This keeps the same Bundle available toqawhen you raise its numeric rollout from0%to50%.