decisionlab
v1.0.13
Published
Ship changes to production immediately. No need to wait for engineers, pull-requests, or code freezes.
Downloads
84
Maintainers
Readme
DecisionLab
Ship changes to production immediately. No need to wait for engineers, pull-requests, or code freezes.
Install decision lab in your React app
Install with
npm i decisionlab
Get your client key at https://app.justdecision.com/account
https://app.justdecision.com/account
You can find your key over there
Configure your app
Add it as a wrapper of your application, ideally as high as you can.
You can either save your DecisionLab key as an environment variable or as any constant, and provide it to your app via the clientKey
prop on the DecisionProvider
component.
import { DecisionProvider } from "decisionlab";
const DECISION_LAB_CLIENT_KEY = "your_application_key"
...
const App = () => {
return (
<DecisionProvider clientKey={DECISION_LAB_CLIENT_KEY}>
<MyAppProviders>Your app goes here</MyAppProviders>
</DecisionProvider>
);
};
Use decisions using the useDecision React hook
import { useDecision } from "decisionlab";
const MyComponent = () => {
const value = useDecision("my_first_decision");
return <div>My value is: {value}</div>;
};