UNPKG

@findify/react-components

Version:
16 lines 582 B
import { useEffect } from 'react'; export default (function (container, item, shouldScroll) { var navigatedProductId = window.localStorage.getItem('findify-navigated-product-id'); var productId = item.get('id'); useEffect(function () { try { if (!shouldScroll || !container.current || navigatedProductId !== productId) return; window.localStorage.removeItem('findify-navigated-product-id'); setTimeout(function () { return container.current.scrollIntoView(); }, 500); } catch (err) { console.log(err); } }, [container]); });