react-tggl-client
v3.0.0
Published
Tggl React SDK
Downloads
1,679
Maintainers
Readme
Usage
Install the dependency:
npm i react-tggl-client
Add the provider to your app:
import { TgglClient, TgglProvider } from 'react-tggl-client'
// Instanciate it outside of your component
const client = new TgglClient('YOUR_API_KEY')
const App = () => {
return (
<TgglProvider client={client}>
{/*...*/}
</TgglProvider>
)
}
Use the hook to evaluate flags:
import { useFlag } from 'react-tggl-client'
const MyComponent = () => {
const { active } = useFlag('myFlag')
//...
}