-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6d686b1
Showing
13 changed files
with
585 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.vscode/ | ||
node_modules/ | ||
src/ | ||
samples/ | ||
tests/ | ||
coverage/ | ||
package-lock.json | ||
tsconfig.*.json | ||
.gitignore | ||
media/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Contributing to the ConfigCat React SDK | ||
|
||
ConfigCat SDK is an open source project. Feedback and contribution are welcome. Contributions are made to this repo via Issues and Pull Requests. | ||
|
||
## Submitting bug reports and feature requests | ||
|
||
The ConfigCat SDK team monitors the [issue tracker](https://github.com/configcat/common-js/issues) in the SDK repository. Bug reports and feature requests specific to this SDK should be filed in this issue tracker. The team will respond to all newly filed issues. | ||
|
||
## Submitting pull requests | ||
|
||
We encourage pull requests and other contributions from the community. | ||
|
||
- Before submitting pull requests, ensure that all temporary or unintended code is removed. | ||
- Be accompanied by a complete Pull Request template (loaded automatically when a PR is created). | ||
- Add unit or integration tests for fixed or changed functionality. | ||
|
||
When you submit a pull request or otherwise seek to include your change in the repository, you waive all your intellectual property rights, including your copyright and patent claims for the submission. For more details please read the [contribution agreement](https://github.com/configcat/legal/blob/main/contribution-agreement.md). | ||
|
||
In general, we follow the ["fork-and-pull" Git workflow](https://github.com/susam/gitpr) | ||
|
||
1. Fork the repository to your own Github account | ||
2. Clone the project to your machine | ||
3. Create a branch locally with a succinct but descriptive name | ||
4. Commit changes to the branch | ||
5. Following any formatting and testing guidelines specific to this repo | ||
6. Push changes to your fork | ||
7. Open a PR in our repository and follow the PR template so that we can efficiently review the changes. | ||
|
||
## Build instructions | ||
|
||
The project uses [npm](https://www.npmjs.com) for dependency management. | ||
|
||
To install dependencies: | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
## Running tests | ||
|
||
```bash | ||
npm test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 ConfigCat | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# ConfigCat SDK for React applications (alpha version) | ||
|
||
https://configcat.com | ||
|
||
ConfigCat SDK for React provides easy integration for your web application to ConfigCat. | ||
|
||
## About | ||
|
||
Manage features and change your software configuration using <a href="https://configcat.com" target="_blank">ConfigCat feature flags</a> | ||
, without the need to re-deploy code. A <a href="https://app.configcat.com" target="_blank">10 minute trainable Dashboard</a> | ||
allows even non-technical team members to manage features directly. Deploy anytime, release when confident. | ||
Target a specific group of users first with new ideas. Supports A/B/n testing and soft launching. | ||
|
||
ConfigCat is a <a href="https://configcat.com" target="_blank">hosted feature flag service</a>. Manage feature toggles across frontend, backend, mobile, desktop apps. <a href="https://configcat.com" target="_blank">Alternative to LaunchDarkly</a>. Management app + feature flag SDKs. | ||
|
||
## Getting Started | ||
|
||
ConfigCat React SDK builts on our configcat-js SDK (TODO link here). It uses Context API (requires React **16.3** or later) and Hook API (requires React **16.8** or later) to provide a better integration in your React application. | ||
|
||
### 1. Install package: | ||
|
||
_via NPM [package](https://npmjs.com/package/configcat-react):_ | ||
|
||
```PowerShell | ||
npm i configcat-react | ||
``` | ||
|
||
### 2. Go to the <a href="https://app.configcat.com/sdkkey" target="_blank">ConfigCat Dashboard</a> to get your _SDK Key_: | ||
|
||
![SDK-KEY](https://raw.githubusercontent.com/ConfigCat/react-sdk/master/media/readme02-3.png "SDK-KEY") | ||
|
||
### 3. Import and initialize ConfigCatProvider | ||
|
||
In most cases you should wrap your root component with `ConfigCatProvider` to access ConfigCat features in child components with Context API. | ||
|
||
```js | ||
import React from "react"; | ||
import { ConfigCatProvider } from "configcat-react"; | ||
|
||
function App() { | ||
return ( | ||
<ConfigCatProvider | ||
client={/* pass your configcat instance */} | ||
> | ||
{/* your application code */} | ||
</ConfigCatProvider> | ||
); | ||
} | ||
|
||
export default App; | ||
``` | ||
|
||
### 4. Get your setting value: | ||
|
||
#### 1. Use React hooks - useFeatureFlag, useConfigCatClient | ||
|
||
The hooks (`useFeatureFlag`) way: | ||
|
||
```js | ||
function ButtonComponent() { | ||
const isAwesomeFeatureEnabled = useFeatureFlag( | ||
"isawesomefeatureenabled", | ||
false | ||
); | ||
|
||
return ( | ||
<button | ||
disabled={!isAwesomeFeatureEnabled} | ||
onClick={() => alert("ConfigCat <3 React")} | ||
> | ||
isAwesomeFeature | ||
</button> | ||
); | ||
} | ||
``` | ||
|
||
## Need help? | ||
|
||
https://configcat.com/support | ||
|
||
## Contributing | ||
|
||
Contributions are welcome. For more info please read the [Contribution Guideline](CONTRIBUTING.md). | ||
|
||
## About ConfigCat | ||
|
||
- [Official ConfigCat SDK's for other platforms](https://github.com/configcat) | ||
- [Documentation](https://configcat.com/docs) | ||
- [Blog](https://blog.configcat.com) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.