Once you've created your feature flag in PostHog, the next step is to add your code:
Boolean feature flags
Multivariate feature flags
Ensuring flags are loaded before usage
Every time a user loads a page, we send a request in the background to fetch the feature flags that apply to that user. We store those flags in a cookie.
This means that for most pages, the feature flags are available immediately – except for the first time a user visits.
To handle this, you can use the onFeatureFlags callback to wait for the feature flag request to finish:
Reloading feature flags
Feature flag values are cached. If something changed with your user and you want to refetch their flag values, call posthog.reloadFeatureFlags().