Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
React SDK
What did you accomplish?
Added a
useTreatment
hook that takes in a single split. Addresses #69How do we test the changes introduced in this PR?
Added tests to verify the new hook. You can test locally via npm-link or yalc in a project repo. One test will fail until I modify further (hence WIP).
Extra Notes
Initially, I wanted to create a
useTreatment
hook that usedclient.getTreatment
. However, the existinguseTreatments
hook is usinggetTreatmentsWithConfig
under the hood, so I chose to follow the existing convention. Shouldn't it instead be usinggetTreatements
and then have auseTreatementsWithConfig
hook that usesgetTreatmentsWithConfig
? I understand that at this point, it would be a version breaking change.The end API that I'd like is
However, because I'm following the existing convention of the
useTreatments
hook, the resulting usage is insteadWould you be okay if I added two hooks?
useTreatment
-> usesclient.getTreatment
useTreatmentWithConfig
-> usesclient.getTreatmentWithConfig
These additions wouldn't be version breaking as they are additive, but it wouldn't follow the existing convention set in place. Looking for feedback and thoughts here!