@splitsoftware/splitio-react
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

Split SDK for React

npm version Build Status

Overview

This SDK is designed to work with Split, the platform for controlled rollouts, which serves features to your users via feature flag to manage your complete customer experience.

Twitter Follow

Compatibility

This SDK is compatible with React 16.8.0 and above, since it uses React Hooks API introduced in that version.

Getting started

Below is a simple example that describes the instantiation and most basic usage of our SDK:

import React from 'react';

// Import SDK functions
import { SplitFactoryProvider, useSplitTreatments } from '@splitsoftware/splitio-react';

// Define your config object
const CONFIG = {
  core: {
    authorizationKey: 'YOUR_SDK_KEY',
    key: 'CUSTOMER_ID'
  }
};

function MyComponent() {
  // Evaluate feature flags with useSplitTreatments hook
  const { treatments: { FEATURE_FLAG_NAME }, isReady } = useSplitTreatments({ names: ['FEATURE_FLAG_NAME'] });

  // Check SDK readiness using isReady prop
  if (!isReady) return <div>Loading SDK ...</div>;

  if (FEATURE_FLAG_NAME.treatment === 'on') {
    // return JSX for on treatment
  } else if (FEATURE_FLAG_NAME.treatment === 'off') {
    // return JSX for off treatment
  } else {
    // return JSX for control treatment
  };
}

function MyApp() {
  return (
    // Use SplitFactoryProvider to instantiate the SDK and makes it available to nested components
    <SplitFactoryProvider config={CONFIG} >
      <MyComponent />
    </SplitFactoryProvider>
  );
}

Please refer to our official docs to learn about all the functionality provided by our SDK and the configuration options available for tailoring it to your current application setup.

Submitting issues

The Split team monitors all issues submitted to this issue tracker. We encourage you to use this issue tracker to submit any bug reports, feedback, and feature enhancements. We'll do our best to respond in a timely manner.

Contributing

Please see Contributors Guide to find all you need to submit a Pull Request (PR).

License

Licensed under the Apache License, Version 2.0. See: Apache License.

About Split

Split is the leading Feature Delivery Platform for engineering teams that want to confidently deploy features as fast as they can develop them. Split’s fine-grained management, real-time monitoring, and data-driven experimentation ensure that new features will improve the customer experience without breaking or degrading performance. Companies like Twilio, Salesforce, GoDaddy and WePay trust Split to power their feature delivery.

To learn more about Split, contact hello@split.io, or get started with feature flags for free at https://www.split.io/signup.

Split has built and maintains SDKs for:

For a comprehensive list of open source projects visit our Github page.

Learn more about Split:

Visit split.io/product for an overview of Split, or visit our documentation at help.split.io for more detailed information.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.11,686latest
2.0.2-rc.04rc

Version History

VersionDownloads (Last 7 Days)Published
2.0.2-rc.04
2.0.11,686
2.0.1-rc.13
2.0.1-rc.01
2.0.01,342
2.0.0-rc.31
2.0.0-rc.20
2.0.0-rc.10
2.0.0-rc.00
1.13.1-rc.10
1.13.1-rc.00
1.13.016,129
1.12.2-rc.00
1.12.11,733
1.12.02,798
1.11.11,267
1.11.1-rc.00
1.11.01,965
1.10.3-rc.40
1.10.3-rc.31
1.10.3-rc.20
1.10.3-rc.10
1.10.3-rc.00
1.10.2158
1.10.1422
1.10.1-rc.00
1.10.07
1.9.1-rc.10
1.9.1-rc.00
1.9.01,326
1.8.4-rc.00
1.8.3679
1.8.3-rc.00
1.8.2162
1.8.2-rc.00
1.8.1658
1.8.1-rc.10
1.8.1-rc.00
1.8.0547
1.7.11,384
1.7.00
1.6.0438
1.5.1-rc.20
1.5.1-rc.10
1.5.0100
1.4.2-rc.20
1.4.2-rc.10
1.4.2-rc.02
1.4.12,369
1.4.1-rc.00
1.4.0329
1.3.1-rc.30
1.3.1-rc.20
1.3.1-rc.116
1.3.1-rc.00
1.3.0601
1.2.7-rc.00
1.2.6571
1.2.6-canary.10
1.2.6-canary.00
1.2.546
1.2.5-canary.00
1.2.4183
1.2.4-canary.20
1.2.4-canary.10
1.2.4-canary.00
1.2.30
1.2.3-canary.20
1.2.3-canary.10
1.2.3-canary.00
1.2.20
1.2.2-canary.00
1.2.2-canary.990
1.2.128
1.2.1-canary.10
1.2.1-canary.00
1.2.055
1.2.0-canary.20
1.2.0-canary.10
1.2.0-canary.00
1.1.08
1.1.0-canary.00
1.0.07
0.7.00
0.6.30
0.6.20
0.6.10
0.5.00
0.1.0-rc.40
0.2.00
0.1.0-rc.30
0.1.0-rc.20
0.1.0-rc.10
0.1.0-rc.01

Package Sidebar

Install

npm i @splitsoftware/splitio-react

Weekly Downloads

37,027

Version

2.0.1

License

Apache-2.0

Unpacked Size

272 kB

Total Files

82

Last publish

Collaborators

  • nicolas.zelaya
  • emiliano-sanchez
  • matias.melograno
  • split-sysadmin
  • ezamora.split
  • harnesssecops