mirror of https://github.com/open-feature/cli.git
36 lines
980 B
Cheetah
36 lines
980 B
Cheetah
'use client';
|
|
|
|
import {
|
|
type ReactFlagEvaluationOptions,
|
|
type ReactFlagEvaluationNoSuspenseOptions,
|
|
useFlag,
|
|
useSuspenseFlag,
|
|
} from "@openfeature/react-sdk";
|
|
{{ range .Flags}}
|
|
/**
|
|
* {{.Docs}}
|
|
*
|
|
* **Details:**
|
|
* - flag key: `{{ .Name}}`
|
|
* - default value: `{{ .DefaultValue }}`
|
|
* - type: `{{TypeString .Type}}`
|
|
*/
|
|
export const use{{FlagVarName .Name}} = (options: ReactFlagEvaluationOptions) => {
|
|
return useFlag({{FlagInitParam .Name}}, {{DefaultValueLiteral .}}, options);
|
|
};
|
|
|
|
/**
|
|
* {{.Docs}}
|
|
*
|
|
* **Details:**
|
|
* - flag key: `{{ .Name}}`
|
|
* - default value: `{{ .DefaultValue }}`
|
|
* - type: `{{TypeString .Type}}`
|
|
*
|
|
* Equivalent to useFlag with options: `{ suspend: true }`
|
|
* @experimental — Suspense is an experimental feature subject to change in future versions.
|
|
*/
|
|
export const useSuspense{{FlagVarName .Name}} = (options: ReactFlagEvaluationNoSuspenseOptions) => {
|
|
return useSuspenseFlag({{FlagInitParam .Name}}, {{DefaultValueLiteral .}}, options);
|
|
};
|
|
{{ end}} |