Adds Howxm capabilities as custom hooks
npm install --save react-use-howxm
const App = () => {
const { initHowxm, identifyHowxm, openHowxm, checkOpenHowxm } = useHowxm();
const campaignId = "<Your Campaign ID>";
const appId = "<Your App ID>";
const uid = "my-uid";
useEffect(() => {
const isReady = initHowxm(appId);
if (isReady) {
identifyHowxm({ uid });
}
}, [initHowxm, identifyHowxm]);
const handleShowClick = () => {
openHowxm(campaignId, { uid }, {age: 30}, () => {
console.log("openHowxm finished");
});
};
const handleCheckClick = () => {
checkOpenHowxm(
campaignId,
uid,
() => {
console.log("checkOpenHowxm success");
},
() => {
console.log("checkOpenHowxm failed");
}
);
};
return (
<>
<h1>Howxm SDK Example</h1>
<button onClick={handleShowClick}>Show</button>
<button onClick={handleCheckClick}>Check</button>
</>
);
};
MIT © warmwind
This hook is created using create-react-hook.
This hook is inspired by react-use-hotjar.