2.1.4 • Published 9 months ago

@scaleway/use-growthbook v2.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@scaleway/use-growthbook

Tiny adapter to easily add GrowthBook to your React Application. The idea of this package is to propose a facade pattern above GrowthBook React SDK.

Install

$ pnpm add @scaleway/use-growthbook

How to use

First add the provider to your application roots

import { AbTestProvider } from '@scaleway/use-growthbook'
import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'

ReactDOM.render(
  <React.StrictMode>
    <AbTestProvider
      config={{ apiHost: 'string', clientKey: 'string', enableDevMode: true }}
      anonymousId="123456789"
      trackingCallback={(experiment, result) => console.log(experiment, result)}
      errorCallback={console.error}
    >
      <App />
    </AbTestProvider>
  </React.StrictMode>,
  document.getElementById('root'),
)

Attributes

A hook useAbTestAttributes is available to get currentAttributes and to set new ones dynamically.

API

Exported utils from GrowthBook React are listed here:

  • FeatureString
  • FeaturesReady
  • IfFeatureEnabled
  • useExperiment
  • useFeature
  • withRunExperiment
  • useFeatureIsOn
  • useFeatureValue
2.1.4

9 months ago

2.1.3

10 months ago

2.1.2

1 year ago

2.1.1

1 year ago

2.1.0

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago