olahol / react-ab Goto Github PK
View Code? Open in Web Editor NEWSimple declarative and universal A/B testing component for React.
Simple declarative and universal A/B testing component for React.
React.CreateElement
is deprecated in React 15.5 and will be removed in 16, also PropTypes has migrated to a separate package prop-types
.
I was excited by the name and the example, but looking at the code it appears you're using the DOM for cookies. How do you manage that back on the server?
basically trying to use 'window' and 'document' will throw an exception on the server, so wrapping their use with a try/catch and returning default values will sort it (tested it manually and it works)
Not an issue but on first look it's hard to understand what the react-ab even does (display, etc)...
Even when looking at the code, maybe better doc or simpler API ?
Not a criticism looks usefull just hard to get started.
Keep up the good work.
In our workplace we use visual diffing tools on snapshots as part of our regression testing.
When taking snapshots for our diffs it would be useful if we could specify a variant by name to keep our visual diffs consistent while a/b testing.
It looks like this is almost possible looking at the API docs, please let me know if this is possible.
First of thanks for developing this component ๐
I was just about to do it myself but luckily googled first.
I'd like to let the app user choose the variant for each experiment via a settings menu. For that I have created a childContext
in my main app component that implements getExperiment(name)
and reads the localStorage
(or for fun from the query
from the current react-router
location
).
Now the UI is displayed like the user wants it.
In that scenario I wonder why onChange
is required and why is it called even when the choice has not been changed.
In some cases we want to test an experiments with nullable children , but it throws warning now.
Hey,
First of all congratulations for this great component !!!
I was wondering if it's possible to use a round robin rule for the experiment.
Thanks!!
There's maybe 2-3 things that an 'isomorphic' react lib should do to differentiate from a 'non isomorphic' one, e.g.
componentDidMount
)window
and document
accessesThis lib is not doing any of the above, and thus I think the term 'isomorphic' in description is misleading
I've seen this: #1
and this part of readme:
get, set and del
Get, set and delete stored experiments. By default these functions use browser cookies. When rendering server side these should be changed appropriately.
and in my opinion they're not enough. You should either provide a clear API for server side usage, or drop 'isomorphic' from description
I see the accessors are already configurable via props: https://github.com/olahol/react-ab/blob/master/react-ab.js#L78-L85
One simple addition that would make this easier for users could be: either accept those props from context
too, or provide a wrapper component that renders the Experiment
component with appropriate accessors props, obtained from context
Server side users would just need to provide accessors in context
(e.g. simple functions accessing node req.cookies
and res
) in their top-level render
As a sidenote, also componentWillMount
setting state
(https://github.com/olahol/react-ab/blob/master/react-ab.js#L99-L111) looks not super safe for universal rendering
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.