How to use the react-instantsearch-core.connectHitInsights function in react-instantsearch-core

To help you get started, we’ve selected a few react-instantsearch-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github algolia / react-instantsearch / stories / InfiniteHits.stories.js View on Github external
.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',
              })
            }
          &gt;
            Add to cart
          </button>
        </div>
      );
github algolia / react-instantsearch / stories / Hits.stories.js View on Github external
.add('with Insights', () =&gt; {
    const insightsClient = (method, payload) =&gt;
      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',
              })
            }
          &gt;
            Add to cart
          </button>
        </div>
      );
    }