React SDK
Installation
# If you use npm:
npm install @context-experiments/react
# Or if you use Yarn:
yarn add @context-experiments/react
We assume that you're using a module bundler (Browserify, Parcel, Webpack, etc.). If you don't yet use npm/yarn or a modern module bundler, we don't support single -file UMD builds yet. We'll add support sometime in the future. Please let us know if that's something you'd like to see.
Design
The React SDK has one primary hook, useFeature
. By contextualizing all interactions
as "Is this Feature enabled?" we minimize code changes, decouple features from one
another, and increase velocity. Below is a list of scenarios that require no code
changes after the initial useFeature
implementation.
- Turn Feature on, partially on, or off
- Update Feature values
- A/B Test different Feature values
- A/B Test between Features
- Accept a winning A/B Test variant
Targeting
The React SDK supports the targeting Features and A/B Tests to specific audiences
using the useTargeting
hook. The hook allows you to match an audience with a particular
Feature or customize a Feature for a specific audience. All of the above scenarios
are compatible with targeting.
Full Documentation
The docs are published at https://docs.contextexperiments.com. We're expanding docs - check back soon for more updates!