You can use DecisionLab Decisions in your React / Node / Nextjs app immediately.
We provide you with an NPM package that you can use to easily integrate DecisionLab in your application.
View package: React Package (npm)In order to integrate DecisionLab in your application, you need:
npm i decisionlab
DecisionLab requires a wrapper (DecisionProvider) in order to serve your app with your Decisions. We recommend setting the DecisionProvider as high as possible in the rendering tree of your application.
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>
);
};
import { useDecision } from "decisionlab";
const MyComponent = () => {
const value = useDecision("my_first_decision");
return <div>My value is: {value}</div>;
};