{"id":16678659,"url":"https://github.com/fdaciuk/react-ff","last_synced_at":"2025-06-11T22:32:52.001Z","repository":{"id":57112620,"uuid":"408957665","full_name":"fdaciuk/react-ff","owner":"fdaciuk","description":"Feature Flag component for React","archived":false,"fork":false,"pushed_at":"2022-03-09T21:27:19.000Z","size":170,"stargazers_count":46,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-29T09:11:51.738Z","etag":null,"topics":["feature-flag","feature-toggle","hacktoberfest","react","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@fdaciuk/react-ff","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fdaciuk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-21T20:00:04.000Z","updated_at":"2024-08-04T19:15:44.000Z","dependencies_parsed_at":"2022-08-21T00:00:51.960Z","dependency_job_id":null,"html_url":"https://github.com/fdaciuk/react-ff","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/fdaciuk/react-ff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdaciuk%2Freact-ff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdaciuk%2Freact-ff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdaciuk%2Freact-ff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdaciuk%2Freact-ff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fdaciuk","download_url":"https://codeload.github.com/fdaciuk/react-ff/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fdaciuk%2Freact-ff/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259354970,"owners_count":22844963,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["feature-flag","feature-toggle","hacktoberfest","react","typescript"],"created_at":"2024-10-12T13:30:04.078Z","updated_at":"2025-06-11T22:32:51.978Z","avatar_url":"https://github.com/fdaciuk.png","language":"TypeScript","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/fdaciuk/react-ff/main/src/feature-flag.svg\" alt=\"React Feature Flag\"\u003e\n\u003c/p\u003e\n\n# Welcome to React Feature Flag 👋\n\n\u003cp\u003e\n  \u003cimg alt=\"Version\" src=\"https://img.shields.io/github/package-json/v/fdaciuk/react-ff?color=blue\u0026style=flat-square\"\u003e\n  \u003ca href=\"https://github.com/fdaciuk/react-ff#readme\" target=\"_blank\"\u003e\n    \u003cimg alt=\"Documentation\" src=\"https://img.shields.io/badge/documentation-yes-brightgreen.svg?style=flat-square\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/fdaciuk/react-ff/graphs/commit-activity\" target=\"_blank\"\u003e\n    \u003cimg alt=\"Maintenance\" src=\"https://img.shields.io/badge/maintained%3F-yes-brightgreen.svg?style=flat-square\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/fdaciuk/react-ff/blob/master/LICENSE.md\" target=\"_blank\"\u003e\n    \u003cimg alt=\"License: MIT\" src=\"https://img.shields.io/github/license/fdaciuk/react-ff?color=brightgreen\u0026style=flat-square\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://twitter.com/fdaciuk\" target=\"_blank\"\u003e\n    \u003cimg alt=\"Twitter: fdaciuk\" src=\"https://img.shields.io/twitter/follow/fdaciuk.svg?style=social\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003e Type safe Components to create Feature Flags (or Feature Toggle) with React.js\n\n## Install\n\n```sh\nyarn add @fdaciuk/react-ff\n```\n\n## Usage\n\nFirst of all, we have to create our componentes using `createFeatureFlag` function.\nCreate a new file (e.g. `src/feature-flag.tsx`) with this content:\n\n```ts\nimport { createFeatureFlag } from '@fdaciuk/react-ff'\n\nexport type Flags = \n  | 'NEW_HEADER'\n  | 'NEW_FOOTER'\n\nconst { FF, FFProvider } = createFeatureFlag\u003cFlags\u003e()\nexport { FF, FFProvider }\n```\n\nNow, on top of your app, import `FFProvider` from `src/feature-flag.tsx`, and pass all the flags your app will use, following the shape:\n\n```ts\nconst flags = {\n  NEW_HEADER: true,\n  NEW_FOOTER: false,\n}\n```\n\nIn the above example, the user has access to something that should be rendered by the flag `NEW_HEADER`, but not by the flag `NEW_FOOTER`.\n\nUsage of `FFProvider`:\n\n```tsx\nfunction App () {\n  const flags = {\n    NEW_HEADER: true,\n    NEW_FOOTER: false,\n  }\n\n  return (\n    \u003cFFProvider flags={flags}\u003e\n      \u003cTheRestOfMyApp /\u003e\n    \u003c/FFProvider\u003e\n  )\n}\n```\n\nNow, anywhere on your app, you can use the `FF` component to make the feature flag (or feature toggle):\n\n```tsx\nfunction TheRestOfMyApp () {\n  return (\n    \u003c\u003e\n      \u003cFF flag='NEW_HEADER' feature={\u003cNewHeader /\u003e}\u003e\n        \u003cOldHeader /\u003e\n      \u003c/FF\u003e\n\n      \u003cFF flag='NEW_FOOTER' feature={\u003cNewFooter /\u003e} /\u003e\n    \u003c/\u003e\n  )\n}\n\nfunction NewHeader () {\n  return (\n    \u003cheader\u003eNew header\u003c/header\u003e\n  )\n}\n\nfunction OldHeader () {\n  return (\n    \u003cheader\u003eOld header\u003c/header\u003e\n  )\n}\n\nfunction NewFooter () {\n  return (\n    \u003cfooter\u003eNew footer\u003c/footer\u003e\n  )\n}\n```\n\nThe `flag` prop is type safe, and will only accept flags from type `Flags`, passed for `createFeatureFlag` function.\n\nThe `children` is optional. You can pass a children when you want to render a fallback component, whether flag is disabled (`false`).\n\n## Author\n\n👤 **Fernando Daciuk - @fdaciuk**\n\n* Website: https://daciuk.dev\n* Twitter: [@fdaciuk](https://twitter.com/fdaciuk)\n* Github: [@fdaciuk](https://github.com/fdaciuk)\n* LinkedIn: [@fdaciuk](https://linkedin.com/in/fdaciuk)\n\n## Credits\n\nLogo by [@vmarcosp](https://github.com/vmarcosp) ♥️\n\n## 🤝 Contributing\n\nContributions, issues and feature requests are welcome!\u003cbr /\u003eFeel free to check [issues page](https://github.com/fdaciuk/react-ff/issues). You can also take a look at the [contributing guide](https://github.com/fdaciuk/react-ff/blob/master/CONTRIBUTING.md).\n\n## Show your support\n\nGive a ⭐️ if this project helped you!\n\n## 📝 License\n\nCopyright © 2021 [Fernando Daciuk - @fdaciuk](https://github.com/fdaciuk).\u003cbr /\u003e\nThis project is [MIT](https://github.com/fdaciuk/react-ff/blob/master/LICENSE.md) licensed.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffdaciuk%2Freact-ff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffdaciuk%2Freact-ff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffdaciuk%2Freact-ff/lists"}