Skip to Content
⚠️Active Development Notice: TimeTiles is under active development. Information may be placeholder content or not up-to-date.

web


web / lib/hooks/use-feature-flags

lib/hooks/use-feature-flags

React Query hook for accessing feature flags client-side.

Provides cached access to feature flags for UI components to adapt based on enabled/disabled features.

Functions

useFeatureFlags()

useFeatureFlags(): UseQueryResult<FeatureFlags, Error>

Hook to access all feature flags.

Returns

UseQueryResult<FeatureFlags, Error>

Example

const { data: flags, isLoading } = useFeatureFlags(); if (!flags?.allowPrivateImports) { // Hide private option }

useFeatureEnabled()

useFeatureEnabled(flag): object

Hook to check if a specific feature is enabled.

Parameters

flag

keyof FeatureFlags

Returns

object

isEnabled

isEnabled: boolean

isLoading

isLoading: boolean

error

error: Error | null

Example

const `{ isEnabled, isLoading }` = useFeatureEnabled("allowPrivateImports");
Last updated on