flipt-react 0.0.12
Install from the command line:
Learn more about npm packages
$ npm install @betrybe/flipt-react@0.0.12
Install via package.json:
"@betrybe/flipt-react": "0.0.12"
About this version
The @betrybe/flipt-react package is a React client for Flipt servers, with it you can evaluate if Feature Flags are enabled or not using the available components and hooks.
In order to install @betrybe/flipt-react you'll have to follow these couple of steps:
- Add the
@betryberegistry to the.npmrcfile for the Github Packages.
@betrybe:registry=https://npm.pkg.github.com/
- Install the package using your package manager
npm i @betrybe/flipt-react # if you're using npm
yarn @betrybe/flipt-react # if you're using yarn
pnpm add @betrybe/flipt-react # if you're using pnpmAfter following these steps, you should be able to use the @betrybe/flipt-react library.
useEvaluation
useEvaluation(flagKey: string, config: EvaluationConfig): {
loading: boolean;
match: boolean;
error: unknown;
};useLazyEvaluation
useEvaluation(flagKey: string, { entityId, context, requestId }: EvaluationConfig): {
evaluate: () => Promise<void>;
loading: boolean;
match: boolean;
error: unknown;
};useBatchEvaluation
useBatchEvaluation(requests: Request[], config: Pick<EvaluationConfig, 'requestId'>): {
loading: boolean;
match: Evaluation<Record<string, string>>[];
error: unknown;
};useLazyBatchEvaluation
useLazyBatchEvaluation(requests: Request[], { requestId }: Pick<EvaluationConfig, 'requestId'>): {
evaluate: () => Promise<void>;
loading: boolean;
match: Evalutation<Record<string, string>>[];
error: unknown;
};Evaluate
function Evaluate({
children,
loading: LoadingComponent,
flagKey,
context,
entityId,
requestId,
}: EvaluateProps): ReactNode;To contribute to the project you can solve the issues created by us or other people in our repository through PRs. Feel free to contribute however you want, all contributions are heartly welcomed :)
To run the project locally, you'll have to install pnpm. For that you can follow the steps in its official documentation.
With that being done, you'll just have to install the project's dependencies and run the package's build script.
pnpm i
pnpm run build --filter @betrybe/flipt-react