@findify/react-components
Version:
Findify react UI components
16 lines • 577 B
JavaScript
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;
setTimeout(function () {
container.current.scrollIntoView();
window.localStorage.removeItem('findify-navigated-product-id');
}, 500);
} catch (err) {
console.log(err);
}
}, [container]);
});