-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hooks refactor #10
Hooks refactor #10
Conversation
Breaking Change ** CoreExperiment now has same Props as Experiment ** - (value becomes defaultVariantName) the call `calculateActiveVariant` has moved from Experiment down to the hook called in CoreExperiment. The public interfaces of `Variant` and `Experiment` remain the same - add hooks implementation - reimplement CoreExperiment as functional component with using hook for implemenation.
BREAKING CHANGE propTypes of CoreExperiment are different than before this branch
Hey @tbrannam, looks like an amazing work, I'll have deep look tomorrow. I'm sorry about the late reply (currently drowning in reviews 😅), thank you for submitting this pull request! 🎉 |
added new test for testing the hook base functionality
It's all good - I think I did everything I wanted to do - just added tests for hooks. |
BREAKING CHANGE Due to modern React requirement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really great work! 🎉
I left a couple of suggestions
renamed hooks.jsx -> hook.jsx to match singular form of other files Require React 16.8
changed to singular form
Think I've addressed all the outstanding issues. One thing that I wonder about revisiting is the need to preregister variants. This is due to the Hook not having any reference to the possible list of variants like the Components would have. I like the hook interface now, but it might work if somehow the variants were passed to the hook as well as an alternative calling pattern. Or maybe it isn't too bad the way it is? |
friendly bump |
I had another deep look at source code and I think it looks really good. One way to solve the last problem that you mentioned would be to extend the useExperiment('experiment_name', {
variants: ['A', 'B'],
defaultVariant: 'A',
userIdentifier: 'pk_123',
}); I think we could potentially merge this PR as it is, release a beta version of v3, test it for a few days and see how it goes, what do you think? |
Sounds good
…________________________________
From: Paolo Moretti <[email protected]>
Sent: Tuesday, September 17, 2019 5:32:42 AM
To: marvelapp/react-ab-test <[email protected]>
Cc: Todd Brannam <[email protected]>; Mention <[email protected]>
Subject: Re: [marvelapp/react-ab-test] Hooks refactor (#10)
I had another deep look at source code and I think it looks really good.
One way to solve the last problem that you mentioned would be to extend the useExperiment hook, eg. use an object for advance configuration:
useExperiment('experiment_name', {
variants: ['A', 'B'],
defaultVariant: 'A',
userIdentifier: 'pk_123',
});
I think we could potentially merge this PR as it, release a beta version of v3, test it for a few days and see how it goes, what do you think?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#10?email_source=notifications&email_token=AAATHXN7ENKIOJ3SKPSMJNLQKCP3VA5CNFSM4IUR4FW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD635R7A#issuecomment-532142332>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AAATHXMIRLUYZZ3MUO5EHN3QKCP3VANCNFSM4IUR4FWQ>.
|
Released in |
Table of Contents
Description
Introduce hooks support
Refactor CoreExperiment to use hooks
Update tests.
Fix slow tests
Motivation and Context
Ready support for react 17.x
Add hooks support for React Functional Components
How Has This Been Tested?
Updated tests related to params changes for core experiment.
Added specific tests for hook, useExperiment
Screenshots (if appropriate):
Types of changes
Checklist: