Curly
Curly

Reputation: 109

React: Making own A/B testing

I am trying to implement a way of displaying different components on a page at different weighted percentages (60% sees variant A and 40% sees variant B). Is it feasible to do this on my own instead of getting a library? I was thinking of handling it inside of componentDidMount and simply creating that will see what variant they will see, then create a cookie based on that and drive the render of the variant they will see from the cookie.
Does that make sense from an implementation point of view?

Upvotes: 0

Views: 484

Answers (1)

Siavas
Siavas

Reputation: 5090

This would surely make sense as it is feasible to do it on your own, but then the question is why would you not use a library? For example, the @marvelapp/react-ab-test already has very good work undertaken by others, which includes weighting variants that is apparently one of your main requirements.

Upvotes: 1

Related Questions