{"_id":"@bitovi/use-async-reducer-state","_rev":"21-28ba53c181ea766d4d55d66bcbb3c26e","name":"@bitovi/use-async-reducer-state","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@bitovi/use-async-reducer-state","version":"0.0.1","author":"","license":"ISC","_id":"@bitovi/use-async-reducer-state@0.0.1","maintainers":[{"name":"jazzy_michael","email":"thejazzymichael@gmail.com"},{"name":"justinbmeyer","email":"justin@bitovi.com"},{"name":"cherif_b","email":"cherif.bouchelaghem@gmail.com"},{"name":"connorg","email":"connormwg@gmail.com"}],"dist":{"shasum":"9d986103ac405b497d379b78256e367d66ae1a1f","tarball":"https://registry.npmjs.org/@bitovi/use-async-reducer-state/-/use-async-reducer-state-0.0.1.tgz","fileCount":5,"integrity":"sha512-D/NCpMT8HDk3oUb9ZylkXJVrRQ0/3HEMEz9uYmPksZbMQNU1zn8A3+kl6CssqSj60f/1r918riP8tXa/ZTQ9uQ==","signatures":[{"sig":"MEUCIGuCtq6we9mwP9GMi0XqMxufT3KxDb0oysbFZszhK+dxAiEAzfYJQ8LVEZh/iK7NIfLRIXTOCKpr5MA5FpF4XuZmrLE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9861,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgmfApCRA9TVsSAnZWagAATMgQAJoHh4vNsweNhfm+C8qw\ndxgOFVSbyK94P/qabJvlQiB7lrySPvPcvrsjseKFZOxYLBuGw50zJyvAV4sz\nhtaOj9zo7JMrc7kSdZg4azAULSCBIk8USf1VvZUyY+0OEGlxHixxnySdXr++\nwnqYJAzqNsQ+2AkaEd3dKYLEGJb7JrLlT+PuPHSKZ7/+K1bd9EUSGZv0FZ12\ngqr2XNYmAZ4N8QFO+/Fh+iFEbvfoBG8awVBAI6GFAgpu+d2RBlLqAGpF/ax+\nWOaQj6qeEwirXXQtfvBP7RviRY9bPEPN5l4GLHbq4m/lC00nXGeOyG7PFgN3\n5DBy/0f24wOO+mFRafubZPJMROFlybB6wJW4cSNlzNY6XpAx/d0KV9nAWj5D\nRNomgTsvHL3QMJr+KHdZu+WoCA33+IvhKGyt5b6yt7zf8UZI6YKUFZwVhqW7\nhhDKLJW7WE4yjoYvSFV86xnQjY6nxSRQKeD+pTbAJvl/C4V2/xrJAr1s3XFE\nW5rQ1DrwrQWl5p8MieJ6Zm7qAVq8h97Ty0WQVaTTi3Bczrfx17w+C2V0Cx98\n9lbz1F93+f3hVYhAaZ/9W0tSga5EebJc/tS4qi4Jm1eO1I4bYq4YMSiW/BL7\nxUKaqGJadF/XF9RpqL/Hi34fv1B+7S9ePpQYuRwenktUNqXsX7mcFMhWubp4\nZr6T\r\n=giS3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","types":"lib/index.d.ts","gitHead":"93a4de7a785aabb9ffe170dbb29a5b6c1a4e1d69","scripts":{"lint":"tslint -p tsconfig.json","test":"jest --config jestconfig.json","build":"tsc","format":"prettier --write \"src/**/*.ts\"","prepare":"npm run build","version":"npm run format && git add -A src","preversion":"npm run lint","postversion":"git push && git push --tags","prepublishOnly":"npm test && npm run lint"},"_npmUser":{"name":"justinbmeyer","email":"justin@bitovi.com"},"_npmVersion":"6.14.5","description":"A reducer to handle async actions","directories":{},"_nodeVersion":"14.4.0","dependencies":{"react":"^17.0.2","@types/react":"^17.0.5"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^26.6.3","tslint":"^6.1.3","ts-jest":"^26.5.6","prettier":"^2.2.1","typescript":"^4.2.4","@types/jest":"^26.0.23","react-test-renderer":"^17.0.2","tslint-config-prettier":"^1.18.0","@testing-library/react-hooks":"^5.1.2"},"_npmOperationalInternal":{"tmp":"tmp/use-async-reducer-state_0.0.1_1620701224663_0.46757993826854394","host":"s3://npm-registry-packages"}},"0.0.2":{"name":"@bitovi/use-async-reducer-state","version":"0.0.2","author":"","license":"ISC","_id":"@bitovi/use-async-reducer-state@0.0.2","maintainers":[{"name":"jazzy_michael","email":"thejazzymichael@gmail.com"},{"name":"justinbmeyer","email":"justin@bitovi.com"},{"name":"cherif_b","email":"cherif.bouchelaghem@gmail.com"},{"name":"connorg","email":"connormwg@gmail.com"}],"dist":{"shasum":"26f1d42c16fae73d5e9c43a6acd8729fe55dcb62","tarball":"https://registry.npmjs.org/@bitovi/use-async-reducer-state/-/use-async-reducer-state-0.0.2.tgz","fileCount":6,"integrity":"sha512-hfLuEV9iDoismxV4NSMy9fbHqL+yj9UVKosYWJ4V1TxkW84tOwedk/hquOvO+/j+xShH4uAnuOQ3ExIUQR48NQ==","signatures":[{"sig":"MEYCIQDVbOyxDnTDxLVaztbQKVtCui/upG59lUAl875pR20ddAIhAMHknyhQDsIb/pCypTG55yLU9RwBZjI0AtCZo8bU5wAM","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11506,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgmfXoCRA9TVsSAnZWagAA0k8P/2CfjiFveQsbD5oF9ULM\nrYD135T37K5MBt5yzX9SjdEEeHkQbAX72dQp+UoXBbLPRtE/ZyOptCQ7mxDN\nxcrC8SEju9W7kl1yo0c7J2mXF22qerDYBgtI2/2qXEcginbY37Dqgn2ACwem\ntksVBbg3owtnCACwh+sHE6IzKhBI2g2MQ2i+JBNUf+J/nr8NTMy93Gp31rZc\nsz+FAkRUmL6VidLXAZjbcze9ayU+VbeSbPYhCMXQ8IV19Veg1uA1fvIGvatj\ntBhkyaFRfD9/QrPCZmd1338CimcmCUuuwxKj5TNDStnJVTMUm3v1qpWIqXnN\n2IgqUsOhOY+zty/hED1sRT8akStkZkhyDz+rE31e3xcOKVuUqABAUBcxAraf\nF/E+ZkCDCz1+u5I5Vf7w1m+xqVHLErss2IE5XOvcopzQo93TPsLHoZ+T9q94\n/5YIu0rEj754HQ7/aBrt9YMCqg6agrIFq1Vbx/G8CzJ5WB/lU1PO0Jfp99dT\nIourW094RitwAe48OxQ8aLIjb12J235qDxKBXVyQLvHQMxp3liMf8G8gz6p+\nBTlapU/sZVvZ0UNbIKhah2tXWn4HjFdzniMYUt4g/FlWlmSglY1fFzzE4i50\n98N+Ep9ljTYYXJqamZ/4Bs+1PqRnjDTf0TItPBgb0uyS8QCDWdH84S36oL/y\n0qpC\r\n=JDt1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","types":"lib/index.d.ts","gitHead":"1106c1f5739b322a6e147804d39942086a62981e","scripts":{"lint":"tslint -p tsconfig.json","test":"jest --config jestconfig.json","build":"tsc","format":"prettier --write \"src/**/*.ts\"","prepare":"npm run build","version":"npm run format && git add -A src","preversion":"npm run lint","postversion":"git push && git push --tags","prepublishOnly":"npm test && npm run lint"},"_npmUser":{"name":"justinbmeyer","email":"justin@bitovi.com"},"_npmVersion":"6.14.5","description":"A reducer to handle async actions","directories":{},"_nodeVersion":"14.4.0","dependencies":{"react":"^17.0.2","@types/react":"^17.0.5"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^26.6.3","tslint":"^6.1.3","ts-jest":"^26.5.6","prettier":"^2.2.1","typescript":"^4.2.4","@types/jest":"^26.0.23","react-test-renderer":"^17.0.2","tslint-config-prettier":"^1.18.0","@testing-library/react-hooks":"^5.1.2"},"_npmOperationalInternal":{"tmp":"tmp/use-async-reducer-state_0.0.2_1620702695487_0.033737048449112184","host":"s3://npm-registry-packages"}}},"time":{"created":"2021-05-11T02:47:04.508Z","modified":"2026-05-21T14:19:12.782Z","0.0.1":"2021-05-11T02:47:04.773Z","0.0.2":"2021-05-11T03:11:35.682Z"},"license":"ISC","description":"A reducer to handle async actions","maintainers":[{"email":"justin@bitovi.com","name":"justinbmeyer"},{"email":"cherif.bouchelaghem@gmail.com","name":"cherif_b"},{"email":"alyshouman@gmail.com","name":"alishouman"},{"email":"os@bitovi.com","name":"bitovi-os"},{"email":"kylebnazario@gmail.com","name":"kyle-n"},{"email":"mhaynie@bitovi.com","name":"mhaynie_bitovi"},{"email":"brad@bitovi.com","name":"bmomberger-bitovi"},{"email":"fabioemoutinho@gmail.com","name":"fabioemoutinho"},{"email":"rich@limnous.com","name":"rlmcneary2"},{"email":"jennifer.wadella@gmail.com","name":"tehfedaykin"},{"email":"kphillips86@gmail.com","name":"phillipskevin"},{"email":"mick.mc.13@gmail.com","name":"mickmcgrath13"},{"email":"core@donejs.com","name":"bitovi-core-os"},{"email":"jane@bitovi.com","name":"janebitovi"},{"email":"DanD.Tran89@gmail.com","name":"dandamantran89"},{"email":"sandover@gmail.com","name":"sandover"}],"readme":"# use-async-reducer-state\n\n`useAsyncStateMethods` is a simple async state mechanism for ReactJS.  It's \ndesigned to be used for managing service state data and result in easy-to-test reducer methods.\n\n\n## Use \n\n\nIn your component, call `useAsyncReducerstate` with:\n\n- The initial state you want to manage\n- A collection of reducer methods, each to be called with the `state` as the first argument and values \n  passed to the `action` method as the second argument.\n\n\n```js\nconst [state, isProcessing, actions] = useAsyncReducerstate(\n    // initial state\n    {count: 0},\n    // collection of reducer methods\n    {\n        async add(state, amountToAdd ){\n            return { ...state, count: state.count + amountToAdd };\n        },\n        async subtract(state, amountToSubtract ){\n            return { ...state, count: state.count - amountToSubtract };\n        }\n    }\n})\n```\n\n`useAsyncReducerstate` returns:\n\n- `state` - The latest state. This will initially return the initial state value, then it will return \n  the values returned by the reducer methods.\n- `isProcessing` - `true` if an async action is running, `false` if otherwise.  This can be used to add loading, spinners\n  or other UI elements to the page.\n- `actions` - An object of methods that can be used to update the state.\n\nWhen the user interacts with the page, call the `actions` methods. For example, \nyou might call `actions.add` and `actions.subtract` as follows:\n\n```jsx\nreturn <div>\n    <button onclick={()=> actions.add(2)}>Two Steps Forward</button>\n\n    <button onclick={()=> actions.subtract(1)}>One Step Back</button>\n\n    <p>Steps: {{state.count}}</p>\n</div>\n```\n\n","readmeFilename":"readme.md"}