Tggl React SDK
npm install react-tggl-client
The React SDK can be used to evaluate flags and report usage to the Tggl API or a proxy.
🔗 Website
•
📚 Documentation
•
📦 NPM
•
🎥 Videos
Install the dependency:
``bash`
npm i react-tggl-client
Add the provider to your app:
`tsx
import { TgglClient, TgglProvider } from 'react-tggl-client'
// Instanciate it outside of your component
const client = new TgglClient({ apiKey: 'YOUR_API_KEY' })
const App = () => {
return (
{/.../}
)
}
`
Use the hook to evaluate flags:
`typescript``
import { useFlag } from 'react-tggl-client'
const MyComponent = () => {
const value = useFlag('myFlag', 'Varation A')
//...
}