Skip to content

[Feature request] useTreatment and useTreatmentWithConfig hooks #69

Open
@besh

Description

@besh

For our team's use case, we often want to get a single split and its treatments. It seems that getTreatment and getTreatmentWithConfig from the underlying javascript-SDK are not currently available as React hooks, but I may have overlooked it in the codebase!

Here's the API I'm thinking of.

const treatment = useTreatment('my_split');

if (treatment === 'on') {
  return <OnComponent />
}

return <OffComponent />

Would you be open to me submitting a PR for this? Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions