{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport { findListDiffIndex } from \"../utils/algorithmUtil\";\nexport default function useDiffItem(data, getKey, onDiff) {\n var _React$useState = React.useState(data),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n prevData = _React$useState2[0],\n setPrevData = _React$useState2[1];\n var _React$useState3 = React.useState(null),\n _React$useState4 = _slicedToArray(_React$useState3, 2),\n diffItem = _React$useState4[0],\n setDiffItem = _React$useState4[1];\n React.useEffect(function () {\n var diff = findListDiffIndex(prevData || [], data || [], getKey);\n if ((diff === null || diff === void 0 ? void 0 : diff.index) !== undefined) {\n onDiff === null || onDiff === void 0 || onDiff(diff.index);\n setDiffItem(data[diff.index]);\n }\n setPrevData(data);\n }, [data]);\n return [diffItem];\n}","map":{"version":3,"names":["_slicedToArray","React","findListDiffIndex","useDiffItem","data","getKey","onDiff","_React$useState","useState","_React$useState2","prevData","setPrevData","_React$useState3","_React$useState4","diffItem","setDiffItem","useEffect","diff","index","undefined"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-virtual-list/es/hooks/useDiffItem.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport { findListDiffIndex } from \"../utils/algorithmUtil\";\nexport default function useDiffItem(data, getKey, onDiff) {\n var _React$useState = React.useState(data),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n prevData = _React$useState2[0],\n setPrevData = _React$useState2[1];\n var _React$useState3 = React.useState(null),\n _React$useState4 = _slicedToArray(_React$useState3, 2),\n diffItem = _React$useState4[0],\n setDiffItem = _React$useState4[1];\n React.useEffect(function () {\n var diff = findListDiffIndex(prevData || [], data || [], getKey);\n if ((diff === null || diff === void 0 ? void 0 : diff.index) !== undefined) {\n onDiff === null || onDiff === void 0 || onDiff(diff.index);\n setDiffItem(data[diff.index]);\n }\n setPrevData(data);\n }, [data]);\n return [diffItem];\n}"],"mappings":"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