
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
react-multivariate
Advanced tools
npm install react-multivariate or
yarn add react-multivariate
The package has two parts:
Component that wraps your app or a smaller section. This could represent the entire app, a single page, or a single component.
name: experiments
type: string[] Array of strings
purpose: A list of enabled experiments to provide to Multivariate components below the provider
name: ready
type: boolean
purpose: Tell Multivariate components they're ready to render
default: true
Component that has a render prop with experiments as an argument
import React from 'react';
import Multivariate, {MultivariateProvider} from 'react-multivariate';
export class App extends React.Component {
experiments = [
'say-goodbye'
];
render() {
return (
<MultivariateProvider experiments={this.experiments}>
<button>
Say
<Multivariate>
{(experiments) => {
if (experiments.includes('say-goodbye')) {
return 'goodbye';
}
return 'hello';
}}
</Multivariate>
</button>
</MultivariateProvider>
);
}
}
import React from 'react';
import {connect} from 'react-redux';
import {MultivariateProvider} from 'react-multivariate';
function mapStateToProps(state) {
return {
experiments: state.experiments
}
}
export default connect(mapStateToProps)((props) => {
return (
<MultivariateProvider experiments={props.experiments}>
<SomeComponent />
</MultivariateProvider>
)
})
import React from 'react';
import Multivariate, {MultivariateProvider} from 'react-multivariate';
import getExperiments from './utils';
export class App extends React.Component {
state = {
experiments: [],
ready: false
}
componentDidMount() {
const experiments = await getExperiments();
this.setState({
experiments,
ready: true
});
}
render() {
return (
<MultivariateProvider experiments={this.experiments}>
<button>
Say
<Multivariate>
{(experiments) => {
if (experiments.includes('say-goodbye')) {
return 'goodbye';
}
return 'hello';
}}
</Multivariate>
</button>
</MultivariateProvider>
);
}
}
import React from 'react';
import {connect} from 'react-redux';
import {MultivariateProvider} from 'react-multivariate';
function mapStateToProps(state) {
return {
experiments: state.experiments
}
}
export default class extends React.Component {
experiments = {
a: [
'alternative-page-a'
],
b: [
'alternative-page-b'
]
}
render() {
return (
<Pages>
<MultivariateProvider
experiments={this.experiments.a}
>
<Multivariate>
{(experiments) => {
if (experiments.includes('alternative-page-a')) {
return <AlternativePageA />;
}
return <PageA />;
}}
</Multivariate>
</MultivariateProvider>
<MultivariateProvider
experiments={this.experiments.b}
>
<Multivariate>
{(experiments) => {
if (experiments.includes('alternative-page-b')) {
return <AlternativePageB />;
}
return <PageB />;
}}
</Multivariate>
</MultivariateProvider>
</Pages>
);
}
}
FAQs
## Installation
We found that react-multivariate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.