{"_id":"use-local-slice","_rev":"8-7a92bb75e79efaa8d0b323ad433aadd5","name":"use-local-slice","dist-tags":{"latest":"1.2.1","alpha":"1.1.0-alpha.0"},"versions":{"1.0.0":{"name":"use-local-slice","description":"A react hook to use reducers for local state in a typesafe way, with an API like createSlice from redux-starter-kit and immer integration.","version":"1.0.0","repository":{"type":"git","url":"git+https://github.com/phryneas/use-local-slice.git"},"author":{"name":"phryneas"},"license":"MIT","private":false,"sideEffects":false,"dependencies":{"immer":"^1.12.1"},"peerDependencies":{"react":">=16.8.0"},"devDependencies":{"@babel/preset-env":"^7.4.3","@babel/preset-typescript":"^7.3.3","@types/jest":"^24.0.11","@types/react":"^16.8.12","@typescript-eslint/eslint-plugin":"^1.6.0","@typescript-eslint/parser":"^1.6.0","eslint":"^5.16.0","eslint-plugin-react-hooks":"^1.6.0","jest":"^24.7.1","microbundle":"^0.11.0","prettier":"^1.16.4","react":"^16.8.6","react-dom":"^16.8.6","react-hooks-testing-library":"^0.4.0","typescript":"^3.4.2"},"main":"dist/index.js","module":"dist/index.mjs","unpkg":"dist/index.umd.js","source":"src/index.ts","types":"dist/index.d.ts","scripts":{"build":"microbundle","dev":"microbundle watch","test":"jest"},"gitHead":"b27f29975e99f3f05aa7d26631523b6410a9510e","bugs":{"url":"https://github.com/phryneas/use-local-slice/issues"},"homepage":"https://github.com/phryneas/use-local-slice#readme","_id":"use-local-slice@1.0.0","_npmVersion":"6.2.0","_nodeVersion":"10.9.0","_npmUser":{"name":"phryneas","email":"mail@lenzw.de"},"dist":{"integrity":"sha512-81qdlG3X35UZtYv9mMLziNciiGKlns9OK64tGSuCmmOyaInGOIZWgY87srPbnVlDw1IFJ5oEr/8RqL0wD+K1hg==","shasum":"4732d8011771a04a76c4f4e8336f82abeab50f77","tarball":"https://registry.npmjs.org/use-local-slice/-/use-local-slice-1.0.0.tgz","fileCount":9,"unpackedSize":13650,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcqlKnCRA9TVsSAnZWagAAP9QP/A3uE+/dRGcZZM90biF7\nIFAZri4tJc/qL/dkRpdQwE7rjC2o/ve/qqIs7P/Ur0loSnAh2rr62R0QvsiF\nMKVgqfVAYnkuC3vaBfO6VbSAsI2cdDAxYUinxCvCrY4tKxCuuBiiskbxwfn+\nVz1KfWC1bqjVYN6kVttbJ69/Vm3CnJVgmR8HRSo83VYNKhUiHELQ2hsKdWt3\nRI56DmTj5qBBoEXcXAFJDdCFskEybtftiYJ7GpGiG62R6thqsMfJ7XG11dGe\n98hmtCIBNgk23PAfhvx7VnQ6WKqZt2ZV+caOfRQCfPCdxePEM27PlwqYAdpK\nvCojBfO35bn9RzzRwobgP8zJ5DUHJ2ake09DPTlI/fhSzd3Ti5tzC3t6fjhY\nPqhafsqtOdrUB+lnJj1kwQZPnE150zgJ5FN+EOaH9qMM89J6UHzG7lOnOLM4\n1tvIQr6V7s0JycYJ2PdReniDY9JawIil7apZDC3xmOVpP4MfZPs/nB2g8e8i\nqp8SZihW2oIjcYbHgBfZNiZJGiAlOFwD4mM/L6RNLoO4I8Vr9JZzwlPrzJpB\ngoeAmv2i7U2GsGECzy6SsPTKO7CiwOlpVMOVWq9LWuv9i//r/hrfbLYzWWtK\nnBLuvuFZ1Nl4Cpb13zxwtfpQBq/aIxNSw6ja63sTdPgJaGtRl70wInsB8bwc\nOiFP\r\n=HX7h\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEMCIA21na/We21y9sTbqLimu4ReB6LQxWWKdoX9KcKUAXEmAh8L87IPUl6oKcLuiYl8x8Y26jSI1n98Ov/NykAdgs7i"}]},"maintainers":[{"name":"phryneas","email":"mail@lenzw.de"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-local-slice_1.0.0_1554666151159_0.35782731929678335"},"_hasShrinkwrap":false},"1.0.1":{"name":"use-local-slice","description":"A react hook to use reducers for local state in a typesafe way, with an API like createSlice from redux-starter-kit and immer integration.","version":"1.0.1","repository":{"type":"git","url":"git+https://github.com/phryneas/use-local-slice.git"},"author":{"name":"phryneas"},"license":"MIT","private":false,"sideEffects":false,"dependencies":{"immer":"^1.12.1"},"peerDependencies":{"react":">=16.8.0"},"devDependencies":{"@babel/preset-env":"^7.4.3","@babel/preset-typescript":"^7.3.3","@types/jest":"^24.0.11","@types/react":"^16.8.12","@typescript-eslint/eslint-plugin":"^1.6.0","@typescript-eslint/parser":"^1.6.0","eslint":"^5.16.0","eslint-plugin-react-hooks":"^1.6.0","jest":"^24.7.1","microbundle":"^0.11.0","prettier":"^1.16.4","react":"^16.8.6","react-dom":"^16.8.6","react-hooks-testing-library":"^0.4.0","rimraf":"^2.6.2","typescript":"^3.4.2"},"main":"dist/index.js","source":"src/index.ts","types":"dist/index.d.ts","scripts":{"build":"rimraf dist/*; microbundle; rimraf dist/*mjs* dist/*umd* dist/*test*","dev":"microbundle watch","test":"jest"},"keywords":["hook","react","reducer","redux-starter-kit","useReducer","immer","redux"],"gitHead":"a28bcbad80c04f643c716eb7851f7a11fae9226d","bugs":{"url":"https://github.com/phryneas/use-local-slice/issues"},"homepage":"https://github.com/phryneas/use-local-slice#readme","_id":"use-local-slice@1.0.1","_npmVersion":"6.2.0","_nodeVersion":"10.9.0","_npmUser":{"name":"phryneas","email":"mail@lenzw.de"},"dist":{"integrity":"sha512-1zKHz5mWqetYMeQBMXzXpnolTG+vEwDYfAoi8kzu4V1ZcBQEe8485L1KCoW+kPmBKPQuUm/JrlO8kOTKSfonzA==","shasum":"d5f8d4670d73e3a517d9f45a19c51136e4819864","tarball":"https://registry.npmjs.org/use-local-slice/-/use-local-slice-1.0.1.tgz","fileCount":5,"unpackedSize":7452,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcq1r6CRA9TVsSAnZWagAAPYoP/2Ts/kAwCAq0xYT5Ib++\nD3JzO0ALwYWCxcdvclUe4K+R8ND5+w7j39Kb6enKm6T64/VkXmHcl2kRgx1y\noaNpmmAv1fI0Gk9p/c/MV3GxYKpljsMzx3tkVCn1HoTn30IOd5TwLIRmBsYo\nwDodUOrrXjy7hox4MKTjsANXiJxk+YEIAVGlPMQovILrT4Lj77r5G4SHNpjF\nvHUGK5xuhnDcn7J3M4VRM+mAgE3hKb0W6gpV/ZF5K65BjlDdmkuQUG/xzob4\nyJlHFN7xj1eiz9V1/nLFHsLIaVh90be/m0jJnNaIWD9q60h4SuNJtoT7npff\nbMzSS4o2QbRW6at1Rh8N1h1o35LtLZf9Vvbtwusikwn6yxiNu1T8xkHW7y+W\nakiCTRZ5KcfWA+0ZE/wSEb6Jz3e/lnURzMMciLHpifUx8mbLpNFGMWHDKkCN\nEH0yxOcCWYTUTFOfthTQi7r7hBt7D0gMGCBX0SMycV3nERGW1fcleyfkSwJs\nGr3yVYV6NIbmfjtXjrhMwaxsFetYY8hrWzN7uPP5EAbb5Wxks6aE5onrD99i\nw49I27XyETjR0yo/DpGNehbgwC4796jpQTIPMW4Knt7waWJaF4caHBzSyRXd\nPSvJNc5EVU+yjUt3aGRWNudafTNF14QKWVHRtpwXgye4R4XNruh4PUQZYq08\n9v2o\r\n=V/Oo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICRWDyboVkKN3H6nqhIQ0k82ujCnQtQY/FHHZxHK28xPAiBDaq8xrxRUQHAW6bysylcO8b1dDO2REnTH8iW0To1jZg=="}]},"maintainers":[{"name":"phryneas","email":"mail@lenzw.de"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-local-slice_1.0.1_1554733817225_0.27261928226056176"},"_hasShrinkwrap":false},"1.1.0-alpha.0":{"name":"use-local-slice","description":"A react hook to use reducers for local state in a typesafe way, with an API like createSlice from redux-starter-kit and immer integration.","version":"1.1.0-alpha.0","repository":{"type":"git","url":"git+https://github.com/phryneas/use-local-slice.git"},"author":{"name":"phryneas"},"license":"MIT","private":false,"sideEffects":false,"dependencies":{"immer":"^1.12.1"},"peerDependencies":{"react":">=16.8.0"},"devDependencies":{"@babel/preset-env":"^7.4.3","@babel/preset-typescript":"^7.3.3","@types/jest":"^24.0.11","@types/react":"^16.8.12","@typescript-eslint/eslint-plugin":"^1.6.0","@typescript-eslint/parser":"^1.6.0","eslint":"^5.16.0","eslint-plugin-react-hooks":"^1.6.0","jest":"^24.7.1","microbundle":"^0.11.0","prettier":"^1.16.4","react":"^16.8.6","react-dom":"^16.8.6","react-hooks-testing-library":"^0.4.0","redux":"^4.0.1","rimraf":"^2.6.2","typescript":"^3.4.2"},"main":"dist/index.js","source":"src/index.ts","types":"dist/index.d.ts","scripts":{"build":"rimraf dist/*; microbundle; rimraf dist/*mjs* dist/*umd* dist/*test*","dev":"microbundle watch","test":"jest"},"keywords":["hook","react","reducer","redux-starter-kit","useReducer","immer","redux"],"readme":"# use-local-slice\n\nAn opinionated react hook to use reducers for local state\n\n- in a typesafe way\n- with an API like [createSlice](https://redux-starter-kit.js.org/api/createslice) from [redux-starter-kit](https://redux-starter-kit.js.org)\n- with [immer](https://github.com/mweststrate/immer) integration\n\n## How to use it\n\n```typescript\nconst [state, dispatchAction] = useLocalSlice({\n  slice: \"my slice\", // optional - will be displayed in the debug tools\n  initialState: { data: \"initial text\", someOtherValue: 5 },\n  reducers: {\n    concat: (state, action: { payload: string }) => {\n      // reducers are passed an immer draft of the current state, so you can directly modify values in the draft\n      state.data += action.payload;\n    },\n    toUpper: state => ({\n      // or you return a modified copy yourself\n      ...state,\n      data: state.data.toUpperCase()\n    })\n    // more reducers ...\n  },\n  middlewares: [] // optional, takes an array of redux middlewares. see warnings below.\n});\n```\n\nand in some callback:\n\n```typescript\ndispatchAction.concat(\"concatenate me!\");\n// or\ndispatchAction.toUpper();\n```\n\nuse-local-slice provides one dispatchAction method per reducer, and (for typescript users) ensures that these dispatchers are only called with correct payload types.\n\n## On Middlewares\n\nMost Redux middlewares should work out of the box with use-local-slice.\n\n_But there are exceptions:_\n\nDue to the asynchronity of React's useReducer (the reducer is only executed on next render), the following construct will not work:\n\n```javascript\nconst middleware = store => next => action => {\n  console.log(\"state before next() is\", store.getState());\n  const retVal = next(action);\n  console.log(\"state after next() is\", store.getState());\n  return retVal;\n};\n```\n\nThat code will log the state _before_ calling the reducer twice, because the reducer is executed asynchronously on next render.\n\nAs this behaviour is highly undependable in Redux anyways (if a middleware that comes after this middleware defers the call to `next(action)` to a later moment, you have the same behaviour there, too), most Redux middlewares will not depend on that behaviour to work, so in general this should break nothing.\n\nBut, _if_ you truly need this behaviour, the following should work (unless another middleware meddles with the call to `next(action)` too much):\n\n```javascript\nconst middleware = store => next => async action => {\n  console.log(\"state before next() is\", store.getState());\n  const retVal = await next(action);\n  console.log(\"state after next() is\", store.getState());\n  return retVal;\n};\n```\n\n## Edge case uses & good to know stuff\n\n- reducers can directly reference other local component state & variables without the need for a `dependencies` array. This is normal `useReducer` behaviour. You can read up on this on the overreacted blog: [Why useReducer Is the Cheat Mode of Hooks](https://overreacted.io/a-complete-guide-to-useeffect/#why-usereducer-is-the-cheat-mode-of-hooks)\n- you can exchange reducers for others between renders - as long as the keys of the `reducers` property do not change, you will get an identical instance of `dispatchAction`.\n- only renaming, adding or removing keys will get you a new `dispatchAction` instance\n","readmeFilename":"README.md","gitHead":"30c7d7a1d9e6782528d66493762bf70dee35e1d1","bugs":{"url":"https://github.com/phryneas/use-local-slice/issues"},"homepage":"https://github.com/phryneas/use-local-slice#readme","_id":"use-local-slice@1.1.0-alpha.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"phryneas","email":"mail@lenzw.de"},"dist":{"integrity":"sha512-fc1Qsl9qjPSg1HLpO+KNzZPc3xcFdmiRviYzTQFNAqtKkJi+LtW0LDoSZsSQ7DaRy5DOKjp8ivKaR8/L1b4pqg==","shasum":"97e1fecc115989cfbc867f73c32f648faacb007b","tarball":"https://registry.npmjs.org/use-local-slice/-/use-local-slice-1.1.0-alpha.0.tgz","fileCount":7,"unpackedSize":15980,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcwz+JCRA9TVsSAnZWagAAvmoQAJz7pIeuXANk8Pd/gB04\nuUJkxU7B9RTcMu2svIwVLkDo7CCS+oBd7G01KYr9Z71e9RFc7aYnRnuJ/B+7\noddnuPgyfMohjHYcmRdDPLXxBH8yWCM1udTK9k9w+QokgPFmzZdVbRZEEyl+\njryKXGfhU5oQi9jp9t1kAzXVfix1igjwdGkARRSeu0xO5a5HA0vP+XM9kIon\nW7W6GuznfBUIfTOTJqQqTNAQnf6BN8Yxj44Xy2E9DMKV2hjjbNFJsCjag7Jy\navtM7I2ryEPjsFJKOF70qwBNYTIpATJldpq6bx4cZntsoovQjCKk/gl5DL1+\n/ggFsgn5r5vsyiHEzzMj6H/vu2AZ+hh/LQrF39SWEsehOKKoFsDjSATIOLoZ\nhWFBHM09dASo+5nCU2M0p4iewCfwXlLCNmUirp1jGTyLmDaVfxHDqstKjppb\nVB7G0YbX9/n2k+NwLX9Rbj+ytQ3KwKTPjNAEl8xFxyEbgNkUaZ3NTsLUtSFK\nCIRqpXcGgO/lTdmdBuLp5tJ+qWgaIK7yk/FfD6TzKYxsPp8Z04XfAXC71+Rl\nzVgP4BYKEDv6/uwUWIiT9y18YMFD+0RS+gAF/FIB320eKNKaUJUNyqfqhktJ\nqhGNJyqsQviv8HiE7nptA4u7ULFxF9cJD0maAZ0WR9+jXunTiOggsAXMAKgZ\necJZ\r\n=Y6fZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHU6MfZpwMIaZZWFw2K8U+cwVMm8sT6+yAPQHOG1avEdAiEAthmTe1pkIxuJbuTvBqjfxVCwswsPAcIazbnhHxdv15Y="}]},"maintainers":[{"name":"phryneas","email":"mail@lenzw.de"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-local-slice_1.1.0-alpha.0_1556299656891_0.14446204245914163"},"_hasShrinkwrap":false},"1.1.0":{"name":"use-local-slice","description":"A react hook to use reducers for local state in a typesafe way, with an API like createSlice from redux-starter-kit and immer integration.","version":"1.1.0","repository":{"type":"git","url":"git+https://github.com/phryneas/use-local-slice.git"},"author":{"name":"phryneas"},"license":"MIT","private":false,"sideEffects":false,"dependencies":{"immer":"^3.1.3"},"peerDependencies":{"react":">=16.8.0"},"devDependencies":{"@babel/preset-env":"^7.4.3","@babel/preset-typescript":"^7.3.3","@types/jest":"^24.0.11","@types/react":"^16.8.12","@typescript-eslint/eslint-plugin":"^1.6.0","@typescript-eslint/parser":"^1.6.0","eslint":"^5.16.0","eslint-plugin-react-hooks":"^1.6.0","jest":"^24.7.1","microbundle":"^0.11.0","prettier":"^1.16.4","react":"^16.8.6","react-dom":"^16.8.6","react-hooks-testing-library":"^0.4.0","rimraf":"^2.6.2","typescript":"^3.4.2"},"main":"dist/index.js","source":"src/index.ts","types":"dist/index.d.ts","scripts":{"build":"rimraf dist/*; microbundle; rimraf dist/*mjs* dist/*umd* dist/*test*","dev":"microbundle watch","test":"jest"},"keywords":["hook","react","reducer","redux-starter-kit","useReducer","immer","redux"],"gitHead":"6fdd7653b767a6073278ebdc90645b1b82ed3890","bugs":{"url":"https://github.com/phryneas/use-local-slice/issues"},"homepage":"https://github.com/phryneas/use-local-slice#readme","_id":"use-local-slice@1.1.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"phryneas","email":"mail@lenzw.de"},"dist":{"integrity":"sha512-ZcqN6EsJnnqEiQ9/mfA/ILvoWLCjJSQYODWgbNhUT7qXYwHfLmI8P22ZEhwXhycoELkGyePIlXNGnCWD5qVuiQ==","shasum":"3fd16696a516e2d387e242c7ee584b6d992d97ec","tarball":"https://registry.npmjs.org/use-local-slice/-/use-local-slice-1.1.0.tgz","fileCount":6,"unpackedSize":8501,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdJ6FyCRA9TVsSAnZWagAA3pAP+wRpOklQDXP5aRR6/KDe\nv3XhqK4ZobiGQc2HqE2c78y8A9tU7i8cdQyocSP/H0M9I+/yralPmGYxiIMG\n5T8YZkqiCa1tQ9VjGiMbDi7Doy2aVlucFc8Zc5iOHRQcyB01KXZtG425weYG\no/nXJInGrdeHPV+UAcY4GUBq7BAqbjhBWBfrtD89KAisHkqiVXH0YuL1STid\nsPynj9eHqDf15KI2RVe5JXRexH7ryxtvgL8mwFJ8L/h/Il84AaC9t39f3yyQ\noM6LsC2LMeH9nMCR+LJqxrsQUuSdvKKiHLOkMTj+kchgbKhLLU44/+ytHBUi\nCw4HG5NGoCYtzY7w16smcCbRjTFsITpfQa39Ge+QTLo59uo+zy5W/gsPfy29\nzpGPbuiu5PqMS+fnNO7izKjL75R5RSPYODFf1iVtxmrk+d4G21Gn0IQjIAP0\n6iWXc+4TnBZWX6sQfSU3B/FxC2051GlrucKklzyAj7MxBxK38QGrSMGumc4i\nAq9WZP4I3GBd5SRsGDGbwR7YaH2r9u6cTChIJaxTErPX76U8KZEJZpIcA903\nv+NZO7fNc4lSLmZxJyVXJdAy1i79zxTx6olQ0mvzXuP43uY4uqk4FJNP/xqk\nAhjWgZz1h4ueaMftr7JJrmGGjBdAarQNiKAsz2dIgRAhsGaf1VMFVwP0Wh3H\nWXUn\r\n=7DAT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID4Bcwv/d0UD7fz0UH8pFfGxqCu+kX30nnkvtzMZGlx2AiBooWUqoh3Pr4EDIxuJiINyZNccI6zZo5Q5MdQnlvA66A=="}]},"maintainers":[{"name":"phryneas","email":"mail@lenzw.de"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-local-slice_1.1.0_1562878321920_0.9577810169070691"},"_hasShrinkwrap":false},"1.1.1":{"name":"use-local-slice","description":"A react hook to use reducers for local state in a typesafe way, with an API like createSlice from redux-starter-kit and immer integration.","version":"1.1.1","repository":{"type":"git","url":"git+https://github.com/phryneas/use-local-slice.git"},"author":{"name":"phryneas"},"license":"MIT","private":false,"sideEffects":false,"dependencies":{"immer":"^3.1.3"},"peerDependencies":{"react":">=16.8.0"},"devDependencies":{"@babel/preset-env":"^7.4.3","@babel/preset-typescript":"^7.3.3","@types/jest":"^24.0.11","@types/react":"^16.8.12","@typescript-eslint/eslint-plugin":"^1.6.0","@typescript-eslint/parser":"^1.6.0","eslint":"^5.16.0","eslint-plugin-react-hooks":"^1.6.0","jest":"^24.7.1","microbundle":"^0.11.0","prettier":"^1.16.4","react":"^16.8.6","react-dom":"^16.8.6","react-hooks-testing-library":"^0.4.0","rimraf":"^2.6.2","typescript":"^3.4.2"},"main":"dist/index.js","source":"src/index.ts","types":"dist/index.d.ts","scripts":{"build":"rimraf dist/*; microbundle; rimraf dist/*mjs* dist/*umd* dist/*test*","dev":"microbundle watch","test":"jest"},"keywords":["hook","react","reducer","redux-starter-kit","useReducer","immer","redux"],"gitHead":"163a9c6d97a7a980b5043d687760670c8bfe5892","bugs":{"url":"https://github.com/phryneas/use-local-slice/issues"},"homepage":"https://github.com/phryneas/use-local-slice#readme","_id":"use-local-slice@1.1.1","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"phryneas","email":"mail@lenzw.de"},"dist":{"integrity":"sha512-fe8wEwH0wVO4m4Y+KvDZ1+HsnK3uqJOGHQTxQnzis88PLWmUnMMSkaWuM0/iRn7ZX73gw1gdawaK56ASCBGpNw==","shasum":"cfbbb3f24d405a726964110966b5d8877338d6a7","tarball":"https://registry.npmjs.org/use-local-slice/-/use-local-slice-1.1.1.tgz","fileCount":6,"unpackedSize":8531,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdQyCACRA9TVsSAnZWagAAkT8P/2gexKiJjXHWRLlk1dQG\nho28iEbzfpovajuHdKhiRTurOn2udmlexUBN4Xmttguf7FfwYtcb/AQn9Eyy\nkkGm427htwu1K9NjJqGE+PLPTShu0CfhOB+8H7YauwP9dSyb8vpiKVUP4cos\nSQtSUxF8EUphNFLoTbKPlCHuPxgeSIWl5QHO98+M/l2efsvs9tba7RQwDn5c\nVgOp1uCW8qo91fzgBrWhptKn15Q2ZbpDtSoWVLETvWNYuZQwsvO8ViCGfxgk\n4CFljh78edI1NbOltdS5kWd9aIhv7MKyUEWNSJGVBOhQsAatasSUk7FKOg40\nJjgC3WdwVfOPnd/2QvcBHARwEdbl01HkgqDn8k3qnEJ936f6mx8A6yUAfDVO\nuqXemTqkTuV+LS8rNRL4UAiaqEC7oZTe+3ocZLP0ptLfGBZa1KmuTe/1lxLP\neSJyP0taN9PWnpEsmfpSF0Rs7qHwf8nTxavl4Ccs6mZ4kKZmB6wb61MeU5ey\nKJAvBIfi2tMs6SFjngtPr7K4TY2KvYgfRzpGOIuQwDJdYA84gkWj6k4tGOPu\nsTrPifmqUmnEaen0Mx45My3atDWRiSwrnbapTC+9PNe1N0ZYQkCNiqOe1mGG\nOhIHVpSGvWVZNyzyOn8vL1WxnFXg2bucQfL6K3VKi6l1mDL+RtJ8jfnfa4F3\nawuU\r\n=j5gs\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCFefEhEFipPSWX+PYykzFKWU+w/1Z3RX18Tsms/h/4OgIgaqzt9TVVVG4/b/aRwEzo+DaEM9uz+8m1XmwpdaoDM8k="}]},"maintainers":[{"name":"phryneas","email":"mail@lenzw.de"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-local-slice_1.1.1_1564680319855_0.6854509690628392"},"_hasShrinkwrap":false},"1.2.0":{"name":"use-local-slice","description":"A react hook to use reducers for local state in a typesafe way, with an API like createSlice from redux-starter-kit and immer integration.","version":"1.2.0","repository":{"type":"git","url":"https://github.com/phryneas/use-local-slice"},"author":{"name":"phryneas"},"license":"MIT","private":false,"sideEffects":false,"dependencies":{"immer":">=1.0.0 <9.0.0"},"peerDependencies":{"react":">=16.8.0"},"devDependencies":{"@babel/preset-env":"^7.12.11","@babel/preset-typescript":"^7.12.7","@testing-library/react-hooks":"^5.0.2","@types/jest":"^26.0.20","@types/react":"^17.0.0","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","eslint":"^7.18.0","eslint-plugin-react-hooks":"^4.2.0","jest":"^26.6.3","microbundle":"0.11","prettier":"^2.2.1","react":"^17.0.1","react-dom":"^17.0.1","react-test-renderer":"^17.0.1","rimraf":"^3.0.2","typescript":"^4.1.3"},"main":"dist/index.js","source":"src/index.ts","types":"dist/index.d.ts","scripts":{"build":"rimraf dist/*; microbundle; rimraf dist/*mjs* dist/*umd* dist/*test*","dev":"microbundle watch","test":"jest"},"keywords":["hook","react","reducer","redux-starter-kit","useReducer","immer","redux"],"licenseText":"MIT License\n\nCopyright (c) 2019 Lenz Weber\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"use-local-slice@1.2.0","dist":{"shasum":"e0b786bc6da6a347c8dcba008833d1637675c488","integrity":"sha512-SAp1SZAuHdmUqEi38RyU17LmmzN37N72y2XJCT3K9OWv21QogVVcHs6IATL+hG8MZg9Ow3zgLw66vuKWAzo09A==","tarball":"https://registry.npmjs.org/use-local-slice/-/use-local-slice-1.2.0.tgz","fileCount":8,"unpackedSize":8636,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgCvP/CRA9TVsSAnZWagAABHMP/jFugbSeI2RTaI3PmY/x\nRAepG/f6aiUBZKeTY4of90Zn4WXzPZSgPcCKbLl7fB7I2jaFDF4ZaOcLnnHm\noeBeixVmA/fzhMAu9M22pVxrM7dMygaSNLE2VY63wPXSwed7cDryA2yMNYpI\nCBQm791llvFYvCCuaEbRJYSEGYuTZBLyJxMDI7cx18O3ZJeEZhHEbe3grFru\nd6AVRH7eUZshv04qBhONEFKXOJbzI5PIcM1ZJit6Xd0oL2qdluvpArgaetf9\nN5ibxow+ZOThWTn2u6olLzUPY5SSrEpCdbnGIdbdftznU6uKl2qqpeE20Gba\nUk9osiIuDLVGtV1yGFKQkPCPCWi8IF5dxPHhFB2wHTOVCaYEaVtEk9NtypkF\nDsUltbXKwSREFNkCaxmEt0qCbx7qEk8/FqSSmcG+P+3h+S0b5/lLRFIe/R7A\nx2TJwQwJvMjmg6kR2zPEz35LAq5Eba+XJkOkIk1cH5fuICrkOkgrZThQ2J9W\nGWphfoYK6cNWrL/TzDSnaKqh6wfJkC6CgApmHf6SD73lMII76Zo8VS9ZaR5U\nxEvqzkKu6xQa5xrsAvDFuKjJ1EFOmEVpykO0h2UAbjpP/Gt8mu3nZItcqCz1\n7IdtJ6CemJrLIL9FP8M2Okot1kPPU/fxZnHix40Y2aSBxDy9Gv8JjMhQeJE7\nvJmc\r\n=PsGK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGXu1/alq3C0m8073uXQvO2yJbIAnYM4CYFTgky8u0h9AiEAhAf9faFXDAOkhKfETMiMDbBN5Nm+GwrphOTt5X1DuNc="}]},"_npmUser":{"name":"phryneas","email":"mail@lenzw.de"},"directories":{},"maintainers":[{"name":"phryneas","email":"mail@lenzw.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-local-slice_1.2.0_1611330558883_0.7124642166410566"},"_hasShrinkwrap":false},"1.2.1":{"name":"use-local-slice","description":"A react hook to use reducers for local state in a typesafe way, with an API like createSlice from redux-starter-kit and immer integration.","version":"1.2.1","repository":{"type":"git","url":"https://github.com/phryneas/use-local-slice"},"author":{"name":"phryneas"},"license":"MIT","private":false,"sideEffects":false,"dependencies":{"immer":">=1.0.0 <10.0.0"},"peerDependencies":{"react":">=16.8.0"},"devDependencies":{"@babel/preset-env":"^7.12.11","@babel/preset-typescript":"^7.12.7","@testing-library/react-hooks":"^5.0.2","@types/jest":"^26.0.20","@types/react":"^17.0.0","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","eslint":"^7.18.0","eslint-plugin-react-hooks":"^4.2.0","jest":"^26.6.3","microbundle":"0.11","prettier":"^2.2.1","react":"^17.0.1","react-dom":"^17.0.1","react-test-renderer":"^17.0.1","rimraf":"^3.0.2","typescript":"^4.1.3"},"main":"dist/index.js","source":"src/index.ts","types":"dist/index.d.ts","scripts":{"build":"rimraf dist/*; microbundle; rimraf dist/*mjs* dist/*umd* dist/*test*","dev":"microbundle watch","test":"jest"},"keywords":["hook","react","reducer","redux-starter-kit","useReducer","immer","redux"],"licenseText":"MIT License\n\nCopyright (c) 2019 Lenz Weber\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"use-local-slice@1.2.1","dist":{"shasum":"7639432e65f3d2d47a47b76cec97c6e03b02cb01","integrity":"sha512-+cKFVECrpUzs0PU5Gge+qJ2k5sT+B+JOm0XrNNYuPh12lmNhuGkRELXMxfI/F2+1TSu1j19iksaawE7ci1qn7A==","tarball":"https://registry.npmjs.org/use-local-slice/-/use-local-slice-1.2.1.tgz","fileCount":8,"unpackedSize":8580,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2/K2CRA9TVsSAnZWagAAzm8QAKGKG/Wx78f5qXUGH60Q\nI9VGoNf8OIcmMIn0H9T06waRDEf94yEa70UOc+kD1fDqMvFyukwL5/BpfbY+\nL+WeYSYx/4mnakn4OHGvKjr2vWFazPWeVNc6KrJHfmK6bmussZiu/d72W7QF\nphDMthgiRwi5l9PMI8xlej/ep7XqcvP00kImGZ8kQVVUSzDotfjEUUOWsE4y\nV99kAQ0hOGA2vm3g0dJCbNuqRhMaFoWyKrqdo2zru3Q5nyMqxJqvKJUcHNSU\nwXdnvGqB4QBd5HsgqaJHUKBi32pBgeeSuQewo6J66t5JCG6ZcP+GkwPq4f64\n3nenA8Ma5q/8b6DArdKAFs4//k6ePEFcdUvnxCRFn47QjjxoJag2mJZrPSG3\nUHx2Az5kw0Up9DR6U5TAMZwbK0CpZ3fi7I620CmuQQfK2Nz1gfsgQfjASsXo\nYkimmpZ9pFOwjp74xcOi/h2yglMWzqUBX1QPycavy6DOUMc0NzD3NU12dVTo\nWG+qfuJtZwwgQ7Tokle6XQQttILhv+sJKTxwZz7XbMXspV4KVmQrNpIbjDCt\no+m3pO5bXCLJKUnjW9TI91Wkghee4Wxqz48Z+pSTIvHmdjllks1rYSJnQ5vK\nnFwHJJraRvMEYEAQKNGn99XdsKO7AZDAJ987CPaimyphsLXnQDX7ntJp+Qc3\n1Nvf\r\n=70zI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDi6fTbXmC2xDvNi6uSSUn8zG/wBxTdTkspwMwZ+bDcXgIgfaPNhVgHKTR0CRKISJ8pxSEGvVpQEMIewnanT+mgqcc="}]},"_npmUser":{"name":"phryneas","email":"mail@lenzw.de"},"directories":{},"maintainers":[{"name":"phryneas","email":"mail@lenzw.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-local-slice_1.2.1_1633543205294_0.7754887954881784"},"_hasShrinkwrap":false}},"time":{"created":"2019-04-07T19:42:31.159Z","1.0.0":"2019-04-07T19:42:31.317Z","modified":"2022-05-22T22:18:43.927Z","1.0.1":"2019-04-08T14:30:17.446Z","1.1.0-alpha.0":"2019-04-26T17:27:37.015Z","1.1.0":"2019-07-11T20:52:02.102Z","1.1.1":"2019-08-01T17:25:19.986Z","1.2.0":"2021-01-22T15:49:18.991Z","1.2.1":"2021-10-06T18:00:05.617Z"},"maintainers":[{"name":"phryneas","email":"mail@lenzw.de"}],"description":"A react hook to use reducers for local state in a typesafe way, with an API like createSlice from redux-starter-kit and immer integration.","repository":{"type":"git","url":"https://github.com/phryneas/use-local-slice"},"author":{"name":"phryneas"},"license":"MIT","readme":"# use-local-slice\n\nAn opinionated react hook to use reducers for local state\n\n- in a typesafe way\n- with an API like [createSlice](https://redux-starter-kit.js.org/api/createslice) from [redux-starter-kit](https://redux-starter-kit.js.org)\n- with [immer](https://github.com/mweststrate/immer) integration\n\n## How to use it\n\n```typescript\nconst [state, dispatchAction] = useLocalSlice({\n  slice: \"my slice\", // optional - will be displayed in the debug tools\n  initialState: { data: \"initial text\", someOtherValue: 5 },\n  reducers: {\n    concat: (state, action: { payload: string }) => {\n      // reducers are passed an immer draft of the current state, so you can directly modify values in the draft\n      state.data += action.payload;\n    },\n    toUpper: state => ({\n      // or you return a modified copy yourself\n      ...state,\n      data: state.data.toUpperCase()\n    })\n    // more reducers ...\n  }\n});\n```\n\nand in some callback:\n\n```typescript\ndispatchAction.concat(\"concatenate me!\");\n// or\ndispatchAction.toUpper();\n```\n\nuse-local-slice provides one dispatchAction method per reducer, and (for typescript users) ensures that these dispatchers are only called with correct payload types.\n\n## Edge case uses & good to know stuff\n\n- reducers can directly reference other local component state & variables without the need for a `dependencies` array. This is normal `useReducer` behaviour. You can read up on this on the overreacted blog: [Why useReducer Is the Cheat Mode of Hooks](https://overreacted.io/a-complete-guide-to-useeffect/#why-usereducer-is-the-cheat-mode-of-hooks)\n- you can exchange reducers for others between renders - as long as the keys of the `reducers` property do not change, you will get an identical instance of `dispatchAction`.\n- only renaming, adding or removing keys will get you a new `dispatchAction` instance\n","readmeFilename":"README.md","keywords":["hook","react","reducer","redux-starter-kit","useReducer","immer","redux"]}