Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

splitio-react

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

splitio-react

react split-io wrapper library

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
64
increased by72.97%
Maintainers
1
Weekly downloads
 
Created
Source

splitio-react

Dependency

This package assumes you would import splitio use CDN (recommended in docs https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK).

<script src="//cdn.split.io/sdk/split-10.8.2.min.js"></script>

Install

yarn add splitio-react

Config

import { SplitIOProvider } from 'splitio-react';

const App = () => (
  <SplitIOProvider
    splitKey={'CUSTOMER_ID'}
    authorizationKey={'SPLIT_IO_API_KEY'}
    attributes={{
      attrA,
      attrB,
      attrC,
      ...otherAttrs
    }}
    splits={[SPLIT_NAMES]}
  >
    <Main />
  </SplitIOProvider>
)

Usage

import { useSplitTreatment } from 'splitio-react';

const SplitView = () => {
  const treatmentValue = useSplitTreatment('SPLIT_NAME');
  const client = useSplitClient();

  useEffect(() => {
    if (treatmentValue === 'on') {
      client.track('traffic type', 'event');
    }
  }, [treatmentValue]);
  return treatmentValue === 'on' ? <div>On</div> : <div>Off</div>
};

FAQs

Package last updated on 13 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc