🎯 Use case
This file lives under “hooks/”, which covers reusable UI or integration hooks. On the API surface it exposes useDynamicConfig — mainly functions, hooks, or classes. Dependencies touch React UI. It composes internal code from services (relative imports).
Generated from folder role, exports, dependency roots, and inline comments — not hand-reviewed for every path.
🧠 Inline summary
import React from 'react' import { getDynamicConfig_BLOCKS_ON_INIT } from '../services/analytics/growthbook.js' /** * React hook for dynamic config values.
📤 Exports (heuristic)
useDynamicConfig
📚 External import roots
Package roots from from "…" (relative paths omitted).
react
🖥️ Source preview
import React from 'react'
import { getDynamicConfig_BLOCKS_ON_INIT } from '../services/analytics/growthbook.js'
/**
* React hook for dynamic config values.
* Returns the default value initially, then updates when the config is fetched.
*/
export function useDynamicConfig<T>(configName: string, defaultValue: T): T {
const [configValue, setConfigValue] = React.useState<T>(defaultValue)
React.useEffect(() => {
if (process.env.NODE_ENV === 'test') {
// Prevents a test hang when using this hook in tests
return
}
void getDynamicConfig_BLOCKS_ON_INIT<T>(configName, defaultValue).then(
setConfigValue,
)
}, [configName, defaultValue])
return configValue
}