1 |
- {"ast":null,"code":"import { useContext } from 'react';\nimport { ReactReduxContext } from '../components/Context';\nimport { useReduxContext as useDefaultReduxContext } from './useReduxContext';\n/**\n * Hook factory, which creates a `useStore` hook bound to a given context.\n *\n * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.\n * @returns {Function} A `useStore` hook bound to the specified context.\n */\n\nexport function createStoreHook(context) {\n if (context === void 0) {\n context = ReactReduxContext;\n }\n\n var useReduxContext = context === ReactReduxContext ? useDefaultReduxContext : function () {\n return useContext(context);\n };\n return function useStore() {\n var _useReduxContext = useReduxContext(),\n store = _useReduxContext.store;\n\n return store;\n };\n}\n/**\n * A hook to access the redux store.\n *\n * @returns {any} the redux store\n *\n * @example\n *\n * import React from 'react'\n * import { useStore } from 'react-redux'\n *\n * export const ExampleComponent = () => {\n * const store = useStore()\n * return <div>{store.getState()}</div>\n * }\n */\n\nexport var useStore = /*#__PURE__*/createStoreHook();","map":{"version":3,"sources":["/home/ilya/projects/NIX/homework/react-store/node_modules/react-redux/es/hooks/useStore.js"],"names":["useContext","ReactReduxContext","useReduxContext","useDefaultReduxContext","createStoreHook","context","useStore","_useReduxContext","store"],"mappings":"AAAA,SAASA,UAAT,QAA2B,OAA3B;AACA,SAASC,iBAAT,QAAkC,uBAAlC;AACA,SAASC,eAAe,IAAIC,sBAA5B,QAA0D,mBAA1D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,SAASC,eAAT,CAAyBC,OAAzB,EAAkC;AACvC,MAAIA,OAAO,KAAK,KAAK,CAArB,EAAwB;AACtBA,IAAAA,OAAO,GAAGJ,iBAAV;AACD;;AAED,MAAIC,eAAe,GAAGG,OAAO,KAAKJ,iBAAZ,GAAgCE,sBAAhC,GAAyD,YAAY;AACzF,WAAOH,UAAU,CAACK,OAAD,CAAjB;AACD,GAFD;AAGA,SAAO,SAASC,QAAT,GAAoB;AACzB,QAAIC,gBAAgB,GAAGL,eAAe,EAAtC;AAAA,QACIM,KAAK,GAAGD,gBAAgB,CAACC,KAD7B;;AAGA,WAAOA,KAAP;AACD,GALD;AAMD;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,IAAIF,QAAQ,GAAG,aAAaF,eAAe,EAA3C","sourcesContent":["import { useContext } from 'react';\nimport { ReactReduxContext } from '../components/Context';\nimport { useReduxContext as useDefaultReduxContext } from './useReduxContext';\n/**\n * Hook factory, which creates a `useStore` hook bound to a given context.\n *\n * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.\n * @returns {Function} A `useStore` hook bound to the specified context.\n */\n\nexport function createStoreHook(context) {\n if (context === void 0) {\n context = ReactReduxContext;\n }\n\n var useReduxContext = context === ReactReduxContext ? useDefaultReduxContext : function () {\n return useContext(context);\n };\n return function useStore() {\n var _useReduxContext = useReduxContext(),\n store = _useReduxContext.store;\n\n return store;\n };\n}\n/**\n * A hook to access the redux store.\n *\n * @returns {any} the redux store\n *\n * @example\n *\n * import React from 'react'\n * import { useStore } from 'react-redux'\n *\n * export const ExampleComponent = () => {\n * const store = useStore()\n * return <div>{store.getState()}</div>\n * }\n */\n\nexport var useStore = /*#__PURE__*/createStoreHook();"]},"metadata":{},"sourceType":"module"}
|