Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.add('with Insights', () => {
const insightsClient = (method, payload) =>
action(`[InsightsClient] sent ${method} with payload`)(payload);
const ProductWithInsights = connectHitInsights(insightsClient)(Product);
function Product({ hit, insights }) {
return (
<div>
<button>
insights('clickedObjectIDsAfterSearch', {
eventName: 'Add to cart',
})
}
>
Add to cart
</button>
</div>
);
.add('with Insights', () => {
const insightsClient = (method, payload) =>
action(`[InsightsClient] sent ${method} with payload`)(payload);
const ProductWithInsights = connectHitInsights(insightsClient)(Product);
function Product({ hit, insights }) {
return (
<div>
<button>
insights('clickedObjectIDsAfterSearch', {
eventName: 'Add to cart',
})
}
>
Add to cart
</button>
</div>
);
}