Skip to content

erdincay/axolotl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Nathan Hutchision
Aug 13, 2015
8a95762 · Aug 13, 2015

History

11 Commits
Aug 13, 2015
Aug 13, 2015
Aug 12, 2015
Aug 12, 2015
Aug 12, 2015
Aug 11, 2015
Aug 12, 2015
Aug 13, 2015
Aug 12, 2015
Aug 11, 2015
Aug 13, 2015
Aug 12, 2015
Aug 13, 2015

Repository files navigation

Axolotl

axolotl

A little bit of stuff to control split variation testing.

https://en.wikipedia.org/wiki/A/B_testing

More docs to come.

Example Usage

import React from 'react';
import Axo from 'axolotl';

class ROFL extends React.Component {
  render() {
    return (
      <div>
        ROFL
        <img style={{width: 40}} src={`http://lorempixel.com/40/40/cats?${Math.random()}`}/>;
      </div>
    );
  }
}

const ROFLVariation =  Axo.VariationEnhance({
  Component: ROFL,
  name: 'rofl',
  description: 'Instead of just saying lol, say rofl.. and a cat',
  visible: true, // allow users to opt in should they choose
});

const axo = new Axo([ROFLVariation]); // default internal flux, default non persisting actions

export default class App extends React.Component {
  static childContextTypes = {
    axo: React.PropTypes.object.isRequired,
  };

  getChildContext() {
    return {
      axo: axo,
    };
  }

  render() {
    <TheRestOfYourApp>
      {/* this could be deep in the component tree*/}
      <ROFLVariation.Else>LOL</ROFLVariation.Else>
      <ROFLVariation>ROFL</ROFLVariation>
    </TheRestOfYourApp>
  }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published