Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@s-ui/abtesting-hooks
Advanced tools
Useful hooks to be used for AB Testing.
$ npm install @s-ui/abtesting-hooks --save
Depending on the params, this hook can assume the following two different roles.
const {isActive, isDefault, isVariation, ...} = useExperiment('myexperiment')
When it's used in some of the children of OptimizelyXExperiment (down in the rendering hierarchy) and only a name is given as a param, it just receives the context from an upper experiment component in the hierarchy.
See OptimizelyXExperiment's readme to see advanced examples about consuming the experiment context: Advanced Usage → Experiment Context.
const {isActive, isDefault, isVariation, ...} = useExperiment({
name: 'myexperiment',
experimentId: 40000,
variations: [
{id: 700000, isDefault: true},
{id: 700001},
{id: 700002}
]
})
When experimentId
and variations
are given as params, it runs an experiment itself so a decision from Optimizely is received and experiment data returned by the hook is updated accordingly.
It behaves in a similar way OptimizelyXExperiment
does because they share the same core. The only differences are:
Also, you may be wondering how to provide experiment context in order to be consumed down in the render hierarchy when the experiment is ran by the hook. Well, you can just feed the OptimizelyXExperiment component with the experiment data, and it will only act as a context provider:
// Run experiment
const experimentData = useExperiment({
name: 'myexperiment',
experimentId: 40000,
variations: [
{id: 700000, isDefault: true},
{id: 700001},
{id: 700002}
]
})
// Use experimentData for anything you like
const {isActive, isDefault, isVariation, ...} = experimentData
// Wrap within OptimizelyXExperiment any area of the render you'd like to
// provide experiment context for.
return (
<OptimizelyXExperiment feed={experimentData}>
...
All the components rendered here are reached by the experiment context,
which can be consumed by `useExperiment('myexperiment')` as well.
...
</OptimizelyXExperiment>
)
To learn more about the experiment experience and how the core works, please read OptimizelyXExperiment's readme since that is already well covered there.
Find full description and more examples in the demo page.
FAQs
Useful hooks to be used for AB Testing.
The npm package @s-ui/abtesting-hooks receives a total of 306 weekly downloads. As such, @s-ui/abtesting-hooks popularity was classified as not popular.
We found that @s-ui/abtesting-hooks demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.