1 line
2.4 KiB
JSON
1 line
2.4 KiB
JSON
|
{"ast":null,"code":"import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport * as React from 'react';\nexport default function usePatchElement() {\n const [elements, setElements] = React.useState([]);\n const patchElement = React.useCallback(element => {\n // append a new element to elements (and create a new ref)\n setElements(originElements => [].concat(_toConsumableArray(originElements), [element]));\n // return a function that removes the new element out of elements (and create a new ref)\n // it works a little like useEffect\n return () => {\n setElements(originElements => originElements.filter(ele => ele !== element));\n };\n }, []);\n return [elements, patchElement];\n}","map":{"version":3,"names":["_toConsumableArray","React","usePatchElement","elements","setElements","useState","patchElement","useCallback","element","originElements","concat","filter","ele"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/antd/es/_util/hooks/usePatchElement.js"],"sourcesContent":["import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport * as React from 'react';\nexport default function usePatchElement() {\n const [elements, setElements] = React.useState([]);\n const patchElement = React.useCallback(element => {\n // append a new element to elements (and create a new ref)\n setElements(originElements => [].concat(_toConsumableArray(originElements), [element]));\n // return a function that removes the new element out of elements (and create a new ref)\n // it works a little like useEffect\n return () => {\n setElements(originElements => originElements.filter(ele => ele !== element));\n };\n }, []);\n return [elements, patchElement];\n}"],"mappings":"AAAA,OAAOA,kBAAkB,MAAM,8CAA8C;AAC7E,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,eAAe,SAASC,eAAeA,CAAA,EAAG;EACxC,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGH,KAAK,CAACI,QAAQ,CAAC,EAAE,CAAC;EAClD,MAAMC,YAAY,GAAGL,KAAK,CAACM,WAAW,CAACC,OAAO,IAAI;IAChD;IACAJ,WAAW,CAACK,cAAc,IAAI,EAAE,CAACC,MAAM,CAACV,kBAAkB,CAACS,cAAc,CAAC,EAAE,CAACD,OAAO,CAAC,CAAC,CAAC;IACvF;IACA;IACA,OAAO,MAAM;MACXJ,WAAW,CAACK,cAAc,IAAIA,cAAc,CAACE,MAAM,CAACC,GAAG,IAAIA,GAAG,KAAKJ,OAAO,CAAC,CAAC;IAC9E,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EACN,OAAO,CAACL,QAAQ,EAAEG,YAAY,CAAC;AACjC","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}
|