{"_id":"pxa-state","_rev":"88-0ff054e0f64643ed8960b3bdfa36c0df","name":"pxa-state","dist-tags":{"latest":"0.0.53"},"versions":{"0.0.49":{"main2":"src/lib/index.js","main":"dist/index.js","name":"pxa-state","version":"0.0.49","keywords":["zustand","immer","state management","state manager","redux","apicontext","react","pxa","baris kuran"],"description":"Zustand - immer combination, the next-generation react state management package.","author":{"name":"Baris Kuran","email":"baris@thepxa.co.uk"},"private":false,"homepage":"https://www.thepxa.co.uk/","repository":{"type":"git","url":"git://github.com/bariskuran/pxa-state"},"license":"MIT","scripts":{"build":"rm -rf dist && NODE_ENV=production babel src/lib --out-dir dist --copy-files","test":"jest --watchAll"},"dependencies":{"immer":"^10.0.2","use-immer":"^0.9.0","zustand":"^4.4.1"},"peerDependencies":{"react":"^18.2.0"},"devDependencies":{"@babel/cli":"^7.20.7","@babel/core":"^7.20.12","@babel/plugin-transform-private-property-in-object":"^7.22.11","@babel/preset-env":"^7.20.2","@babel/preset-react":"^7.22.15","babel-loader":"^8.0.6","core-js":"^3.32.2","eslint":"^8.49.0","eslint-config-react-app":"^7.0.1","eslint-plugin-jest":"^27.4.3","eslint-plugin-react":"^7.33.2","eslint-plugin-react-hooks":"^4.6.0","prettier":"^3.0.3"},"licenseText":"MIT License\n\nCopyright (c) 2023 Baris Kuran\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":"pxa-state@0.0.49","dist":{"shasum":"832ad044b7b2a4d933fdc9fb574da6185da94b69","integrity":"sha512-oKQhc7qA+OMds20EPGkfcaV6bL+aiSIcing2BHMxl4qcO8pZgj3hFgoV8kVYqqwf2BnMV+RJb8sMM0G/XIBJWA==","tarball":"https://registry.npmjs.org/pxa-state/-/pxa-state-0.0.49.tgz","fileCount":17,"unpackedSize":75140,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDMJOO4ZeOA9+UmEMOR6JHil/kVbLPJSHUNJ5vK8UI8NgIgE7oJMVm7bhtG9ED+/jGcTUvYnJ6G9GaLw+RKisYKzJI="}]},"_npmUser":{"name":"bariskuran","email":"bariskuran@gmail.com"},"directories":{},"maintainers":[{"name":"bariskuran","email":"bariskuran@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pxa-state_0.0.49_1700145007047_0.32415104577479137"},"_hasShrinkwrap":false},"0.0.50":{"main2":"src/lib/index.js","main":"dist/index.js","name":"pxa-state","version":"0.0.50","keywords":["zustand","immer","state management","state manager","redux","apicontext","react","pxa","baris kuran"],"description":"Zustand - immer combination, the next-generation react state management package.","author":{"name":"Baris Kuran","email":"baris@thepxa.co.uk"},"private":false,"homepage":"https://www.thepxa.co.uk/","repository":{"type":"git","url":"git://github.com/bariskuran/pxa-state"},"license":"MIT","scripts":{"build":"rm -rf dist && NODE_ENV=production babel src/lib --out-dir dist --copy-files","test":"jest --watchAll"},"dependencies":{"immer":"^10.0.2","use-immer":"^0.9.0","zustand":"^4.4.1"},"peerDependencies":{"react":"^18.2.0"},"devDependencies":{"@babel/cli":"^7.20.7","@babel/core":"^7.20.12","@babel/plugin-transform-private-property-in-object":"^7.22.11","@babel/preset-env":"^7.20.2","@babel/preset-react":"^7.22.15","babel-loader":"^8.0.6","core-js":"^3.32.2","eslint":"^8.49.0","eslint-config-react-app":"^7.0.1","eslint-plugin-jest":"^27.4.3","eslint-plugin-react":"^7.33.2","eslint-plugin-react-hooks":"^4.6.0","prettier":"^3.0.3"},"licenseText":"MIT License\n\nCopyright (c) 2023 Baris Kuran\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":"pxa-state@0.0.50","dist":{"shasum":"d4360f369bf1a9d8e976c12e6179544cead7612c","integrity":"sha512-bt6t6KX8cSlVS84O+zDXlF0Q+RVOjCtdu0sNYNOnr5fmKIsj74cpiFy1bZ77rxdo8Feh7igzvQSk7Qe0rYo24g==","tarball":"https://registry.npmjs.org/pxa-state/-/pxa-state-0.0.50.tgz","fileCount":17,"unpackedSize":75835,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGBt+3md01sQv9HBLHqu4wAZOiil810Bi9ni+ZwtWXM5AiB7OsrmbqW4j/QaF5qA45uSvgObD0h2qEOzd9B6c75nMQ=="}]},"_npmUser":{"name":"bariskuran","email":"bariskuran@gmail.com"},"directories":{},"maintainers":[{"name":"bariskuran","email":"bariskuran@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pxa-state_0.0.50_1700146409547_0.690350649281549"},"_hasShrinkwrap":false},"0.0.51":{"main2":"src/lib/index.js","main":"dist/index.js","name":"pxa-state","version":"0.0.51","keywords":["zustand","immer","state management","state manager","redux","apicontext","react","pxa","baris kuran"],"description":"Zustand - immer combination, the next-generation react state management package.","author":{"name":"Baris Kuran","email":"baris@thepxa.co.uk"},"private":false,"homepage":"https://www.thepxa.co.uk/","repository":{"type":"git","url":"git://github.com/bariskuran/pxa-state"},"license":"MIT","scripts":{"build":"rm -rf dist && NODE_ENV=production babel src/lib --out-dir dist --copy-files","test":"jest --watchAll"},"dependencies":{"immer":"^10.0.2","use-immer":"^0.9.0","zustand":"^4.4.1"},"peerDependencies":{"react":"^18.2.0"},"devDependencies":{"@babel/cli":"^7.20.7","@babel/core":"^7.20.12","@babel/plugin-transform-private-property-in-object":"^7.22.11","@babel/preset-env":"^7.20.2","@babel/preset-react":"^7.22.15","babel-loader":"^8.0.6","core-js":"^3.32.2","eslint":"^8.49.0","eslint-config-react-app":"^7.0.1","eslint-plugin-jest":"^27.4.3","eslint-plugin-react":"^7.33.2","eslint-plugin-react-hooks":"^4.6.0","prettier":"^3.0.3"},"licenseText":"MIT License\n\nCopyright (c) 2023 Baris Kuran\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":"pxa-state@0.0.51","dist":{"shasum":"41a4228b049100deafb0177fa29c551ff7bf0084","integrity":"sha512-firYpcC51MAZ8750HdFCWwzGxETFkKPHxms+2+szvobgnn9bZIdatVh9srQXXDqX7v5OUofAu2QeSuFFcr/CKg==","tarball":"https://registry.npmjs.org/pxa-state/-/pxa-state-0.0.51.tgz","fileCount":17,"unpackedSize":63129,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG5K3/3pDPXGbsnYrPNikQRdZl3ubOojGSM1HvgehjWUAiEA3W6UR53R1aFxvCLTQVSNnmMamc7hECBaDUpM2ps2Gac="}]},"_npmUser":{"name":"bariskuran","email":"bariskuran@gmail.com"},"directories":{},"maintainers":[{"name":"bariskuran","email":"bariskuran@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pxa-state_0.0.51_1700149604693_0.8548341146408731"},"_hasShrinkwrap":false},"0.0.52":{"main2":"src/lib/index.js","main":"dist/index.js","name":"pxa-state","version":"0.0.52","keywords":["zustand","immer","state management","state manager","redux","apicontext","react","pxa","baris kuran"],"description":"Zustand - immer combination, the next-generation react state management package.","author":{"name":"Baris Kuran","email":"baris@thepxa.co.uk"},"private":false,"homepage":"https://www.thepxa.co.uk/","repository":{"type":"git","url":"git://github.com/bariskuran/pxa-state"},"license":"MIT","scripts":{"build":"rm -rf dist && NODE_ENV=production babel src/lib --out-dir dist --copy-files","test":"jest --watchAll"},"dependencies":{"immer":"^10.0.2","use-immer":"^0.9.0","zustand":"^4.4.1"},"peerDependencies":{"react":"^18.2.0"},"devDependencies":{"@babel/cli":"^7.20.7","@babel/core":"^7.20.12","@babel/plugin-transform-private-property-in-object":"^7.22.11","@babel/preset-env":"^7.20.2","@babel/preset-react":"^7.22.15","babel-loader":"^8.0.6","core-js":"^3.32.2","eslint":"^8.49.0","eslint-config-react-app":"^7.0.1","eslint-plugin-jest":"^27.4.3","eslint-plugin-react":"^7.33.2","eslint-plugin-react-hooks":"^4.6.0","prettier":"^3.0.3"},"licenseText":"MIT License\n\nCopyright (c) 2023 Baris Kuran\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":"pxa-state@0.0.52","dist":{"shasum":"7fcd29737e5eac779534437be6da5975b9d42c36","integrity":"sha512-xsg3pYZVkihaAvrfh+9cSoTjca4YxpSnvUsGjhfvLoxbSuFvIeLeh0athO2S+gMOq8i92XZEPdvSDBgpD6T/Yg==","tarball":"https://registry.npmjs.org/pxa-state/-/pxa-state-0.0.52.tgz","fileCount":17,"unpackedSize":59650,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHdPEUkYNcA0Qo4yL1uAdrBv3t3lUlfzKMwltlUVsSZNAiAJYUCdCPzt6USMeFejdx+EJbooSiLKiDRsAKgXjgslQA=="}]},"_npmUser":{"name":"bariskuran","email":"bariskuran@gmail.com"},"directories":{},"maintainers":[{"name":"bariskuran","email":"bariskuran@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pxa-state_0.0.52_1700151462786_0.6893796508106729"},"_hasShrinkwrap":false},"0.0.53":{"main2":"src/lib/index.js","main":"dist/index.js","name":"pxa-state","version":"0.0.53","keywords":["zustand","immer","state management","state manager","redux","apicontext","react","pxa","baris kuran"],"description":"Zustand - immer combination, the next-generation react state management package.","author":{"name":"Baris Kuran","email":"baris@thepxa.co.uk"},"private":false,"homepage":"https://www.thepxa.co.uk/","repository":{"type":"git","url":"git://github.com/bariskuran/pxa-state"},"license":"MIT","scripts":{"build":"rm -rf dist && NODE_ENV=production babel src/lib --out-dir dist --copy-files","test":"jest --watchAll"},"dependencies":{"immer":"^10.0.2","use-immer":"^0.9.0","zustand":"^4.4.1"},"peerDependencies":{"react":"^18.2.0"},"devDependencies":{"@babel/cli":"^7.20.7","@babel/core":"^7.20.12","@babel/plugin-transform-private-property-in-object":"^7.22.11","@babel/preset-env":"^7.20.2","@babel/preset-react":"^7.22.15","babel-loader":"^8.0.6","core-js":"^3.32.2","eslint":"^8.49.0","eslint-config-react-app":"^7.0.1","eslint-plugin-jest":"^27.4.3","eslint-plugin-react":"^7.33.2","eslint-plugin-react-hooks":"^4.6.0","prettier":"^3.0.3"},"licenseText":"MIT License\n\nCopyright (c) 2023 Baris Kuran\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":"pxa-state@0.0.53","dist":{"shasum":"5f4ed2a96ce2a2b516c73342d6b691772b088516","integrity":"sha512-uOnWo6bDnKVUalOlGAnV/kCz604THftn+jqjnIlRvbcznvt7Euui4IA505Vc67khnIMQi2C2Qg9cmK5HGILIAw==","tarball":"https://registry.npmjs.org/pxa-state/-/pxa-state-0.0.53.tgz","fileCount":17,"unpackedSize":76069,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA+dyfZAerxchueA8y05pQoksDzUYVwmq/4uHFKb5SXtAiBgMAwEqs5VrlFma+4+YOLt7gPnQPsyaZQHGlyl3FOglA=="}]},"_npmUser":{"name":"bariskuran","email":"bariskuran@gmail.com"},"directories":{},"maintainers":[{"name":"bariskuran","email":"bariskuran@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pxa-state_0.0.53_1700151874799_0.22635017989562756"},"_hasShrinkwrap":false}},"time":{"created":"2023-10-10T20:16:56.289Z","0.0.1":"2023-10-10T20:16:56.514Z","modified":"2023-11-16T16:24:35.201Z","0.0.12":"2023-10-10T20:56:33.739Z","0.0.13":"2023-10-10T21:02:33.294Z","0.0.14":"2023-10-10T21:04:09.522Z","0.0.15":"2023-10-10T21:14:41.867Z","0.0.16":"2023-10-10T21:19:49.985Z","0.0.17":"2023-10-10T21:22:51.398Z","0.0.18":"2023-10-10T21:34:26.664Z","0.0.19":"2023-10-10T22:01:26.020Z","0.0.200":"2023-10-10T22:25:32.144Z","0.0.201":"2023-10-10T22:28:35.435Z","0.0.202":"2023-10-10T22:30:42.046Z","0.0.203":"2023-10-12T20:01:02.950Z","0.0.204":"2023-10-12T21:09:57.585Z","0.0.205":"2023-10-12T21:41:07.688Z","0.0.206":"2023-10-12T21:44:25.575Z","0.0.207":"2023-10-12T21:56:56.239Z","0.0.208":"2023-10-12T22:24:50.055Z","0.0.209":"2023-10-12T23:39:51.267Z","0.0.210":"2023-10-12T23:48:53.126Z","0.0.211":"2023-10-12T23:50:47.773Z","0.0.212":"2023-10-14T17:10:28.666Z","0.0.213":"2023-10-14T20:32:51.295Z","0.0.214":"2023-10-14T20:38:06.392Z","0.0.215":"2023-10-14T20:53:41.654Z","0.0.216":"2023-10-16T14:09:27.858Z","0.0.217":"2023-10-16T14:16:59.432Z","0.0.218":"2023-10-16T14:25:46.677Z","0.0.219":"2023-10-16T14:40:13.649Z","0.0.22":"2023-10-16T14:50:39.974Z","0.0.30":"2023-10-16T17:53:40.216Z","0.0.40":"2023-10-23T13:26:02.031Z","0.0.41":"2023-10-25T19:45:12.652Z","0.0.42":"2023-10-29T22:09:06.687Z","0.0.43":"2023-10-30T03:40:39.354Z","0.0.44":"2023-10-31T18:40:37.565Z","0.0.45":"2023-10-31T18:44:21.486Z","0.0.46":"2023-10-31T18:51:18.779Z","0.0.47":"2023-11-01T01:20:29.249Z","0.0.4-8.1":"2023-11-10T18:35:20.286Z","0.0.48-alpha.1":"2023-11-10T18:40:29.030Z","0.0.48":"2023-11-16T14:15:27.797Z","0.0.49":"2023-11-16T14:30:07.215Z","0.0.50":"2023-11-16T14:53:29.689Z","0.0.51":"2023-11-16T15:46:44.963Z","0.0.52":"2023-11-16T16:17:42.955Z","0.0.53":"2023-11-16T16:24:35.022Z"},"maintainers":[{"name":"bariskuran","email":"bariskuran@gmail.com"}],"description":"Zustand - immer combination, the next-generation react state management package.","keywords":["zustand","immer","state management","state manager","redux","apicontext","react","pxa","baris kuran"],"repository":{"type":"git","url":"git://github.com/bariskuran/pxa-state"},"author":{"name":"Baris Kuran","email":"baris@thepxa.co.uk"},"readme":"<img src=\"https://www.thepxa.co.uk/pxa-state.jpg\" alt=\"pxa-state\" title=\"pxa-state\" width=\"150\" height=\"150\" />\n\n[![npm version](https://badge.fury.io/js/pxa-state.svg)](//npmjs.com/package/pxa-state)\n\n# Recommendation\n\nThis library is being developed and tested day by day. I recommend waiting until version 0.1.0 or keeping track of continuous updates.\n\n# Introduction\n\n**pxa-state** is a React state management tool that combines the functionalities of zustand and immer libraries. Additionally, it facilitates usage to some extent by introducing new set and call methods. It can operate both local components and global components.\n\nThis mini tool aims to address state management challenges in React. It was developed to address issues such as the complexity created by useState, the difficulty of using nested objects, the need to render all components covered by ContextApi, and the constant requirement to write reducers in the usage of global management solutions like Redux, all under one roof.\n\n### Demos\n\n[usePxaState](https://codesandbox.io/s/usepxastate-slqw9c)\n\n[usePxaContext - setOutsideHooks](https://codesandbox.io/s/usepxacontext-static-zn9ghh)\n\n[usePxaContext - reSetInsideHooks](https://codesandbox.io/s/usepxacontext-dynamic-29yqm7)\n\n# Installing pxa-state\n\n```node\nnpm i pxa-state\n```\n\n```node\nyarn add pxa-state\n```\n\n```node\npnpm i pxa-state\n```\n\n# Basic Usage of usePxaState\n\nThis function is used instead of _useState_.\n\n#### for immutable types\n\n```js\nimport { usePxaState } from \"pxa-state\";\n\nconst Component = () => {\n    const {value, set} = usePxaState(123);\n\tconst fn = () => {\n\t\tset(d=>({value: d.value + 1}));\n\t}\n\n// result: {value:123}\n```\n\n> [!IMPORTANT]\n> Functions can not be used as an immutable varible!\n\n#### for mutable types\n\n```js\nimport { usePxaState } from \"pxa-state\";\n\nconst Component = () => {\n    const {no,str,set} = usePxaState({no:1,str:\"str\"});\n\tconst fn = () => {\n\t\tset(d=>({\n\t\t\tno: d.no + 1,\n\t\t\tstr: \"new str\",\n\t\t\t\"nested.obj.prop\": true,\n\t\t}))\n\t}\n\n// result: {\n//\tno:2,\n//\tstr: \"new str\",\n//\tnested:{\n//\t\tobj:{\n//\t\t\tprop:true,\n//\t\t}\n//\t}\n//}\n\n```\n\n#### Advanced Usage Example\n\n[usePxaState](https://codesandbox.io/s/usepxastate-slqw9c)\n\n# Basic Usage of usePxaContext\n\nThis function is used instead of _useContext_ or _Redux_ or similar.\n\n```js\nimport { createPxaContext, usePxaContext, useSetContext } from \"pxa-state\";\n```\n\nYou can create the context outside of a React Component:\n\n```js\nconst globalContext = createPxaContext(initialValue, settings);\n//...\n```\n\nOr, you can create the context inside a React Component:\n\n```js\nconst globalContext = createPxaContext();\n\nconst Component1 = () => {\n\tconst state = useSetContext(globalContext, async () => {\n    // do smth in here... for example make an api call...\n    // const response = await fetch(\"https://randomuser.me/api/\");\n    // const data = await response.json();\n\n    return [initialValue, settings];\n  }, (s) => [s.no, s.str, s.set]);\n\n//...\n```\n\nThen you can use context wherever you wish to use.\n\n```js\nconst Component2 = () => {\n\tconst { no, str, set } = usePxaContext(globalContext, (s) => [s.no, s.str, s.set]);\n\tconst  fn = () => {\n\t\tset(d=>({\n\t\t\tno: d.no + 1,\n\t\t\tstr: \"new str\",\n\t\t\t\"nested.obj.prop\": true,\n\t\t}))\n\t}\n\n// result: {\n//\tno:2,\n//\tstr: \"new str\",\n//\tnested:{\n//\t\tobj:{\n//\t\t\tprop:true,\n//\t\t}\n//\t}\n//}\n```\n\nAlso, you can call nested values as well. But keep in mind, you should name it level1's key name at the call.\n\n```js\nconst { level1 } = usePxaContext(globalContext, (s) => [s.level1.level2.level31, s.level1.level2.level32]);\n\n// result: {\n// level1: {\n//\tlevel2:{\n// \t\tlevel31:any,\n// \t\tlevel32:any,\n// }}\n\n// At this example, you can reach deep nested values like this:\n<div>{level1?.level2?.level31}</div>;\n```\n\n#### Advanced Usage Example\n\n[usePxaContext - setOutsideHooks](https://codesandbox.io/s/usepxacontext-static-zn9ghh)\n\n[usePxaContext - reSetInsideHooks](https://codesandbox.io/s/usepxacontext-dynamic-29yqm7)\n\n# Features\n\nFor feature descriptions, I used usePxaState.\nHowever, all features work the same way in createPxaContext.\n\n#### Changing immutable key name\n\nEasy. Define it inside settings.\n\n```js\nconst state = usePxaState(\"test string\", {\n    immutableKeyName: \"data\",\n});\n// result: {data:\"test string\"}\n```\n\n#### Adding functions inside the context\n\nEasy. Place them inside settings. Context functions gets state prop first, then optional args.\n\n```js\nconst state = usePxaState(initialValue, {\n    externalFunction: (state, arg1, arg2) => {},\n    anotherFunction: (state, arg3, arg4, arg5) => {},\n});\n```\n\nNow you can access functions via state when you need them. For example:\n\n```js\nstate.anotherFunction(arg3, arg4, arg5);\n```\n\n#### Using changeListener\n\nEasier. If you set the _changeListener_ inside settings, the listener function will be triggered on all state changes. In this way, you get a small-scale React's _useEffect_ function. Moreover, changeListener works faster and triggers earlier than useEffect. It gets _keys_ array, _latestValues_ object and _previousValues_ object.\n\n```js\nconst state = usePxaState(initialValue, {\n    changeListener: (keys, latestValues, previousValues) => {},\n});\n```\n\n> [!IMPORTANT]\n> The changeListener method sends nested variables in quotes.\n\nExample response:\n\n```js\nconst changeListener = (keys, latestValues, previousValues) => {\n    if (keys.includes(\"p1.p2.p3\")) {\n        // ... do smth\n    }\n};\n```\n\n#### get Method\n\nTBH, you don't need to use this function much but, if you do:\n\n```js\nconst currState = state.get();\n```\n\n#### getPrevious Method\n\nIf you need to get one step back, you can use getPrevious\n\n```js\nconst previousState = state.getPrevious();\n```\n\n#### set Method\n\nIf your data is immutable, you need to set it via immutableKeyName. (**\"value\"** is default).\n\n```js\nset({\n    value: \"new string\",\n});\n```\n\nif it mutable, use it normally.\n\n```js\nset({\n    no: 2,\n    str: \"str+\",\n    arr: [1, 2, 3, 45],\n});\n```\n\nWhether defined or not, you can access key names in nested levels by enclosing them in quotation marks.\n\n```js\nset({\n    \"person.address.city.isValid\": true,\n});\n```\n\nIf you need state in set, return a function instead of an object:\n\n```js\nset((state) => ({\n    no: state.no + 1,\n    str: state.str + \"+\",\n}));\n```\n\n#### immerSet Method\n\nimmerSet is original setImmer function without any change. Check out useImmer documantation for more info.\n\n```js\nimmerSet(draft=>{\n\tno: draft.no + 1,\n\tstr: \"str+\",\n\tarr: [1, 2, 3, 45],\n});\n```\n\n#### reSet Method\n\nIf you need to reSet state or context, you can use reSet to add new functions to your context.\n\n```js\nreSet(initialValue, settings);\n```\n\n# Api\n\n> const state = usePxaState(**initialValue**,**stateSettings**);\n\n> const globalContext = createPxaContext(**initialValue**,**stateSettings**)\n\n| initialValue | any - optional                                                                                    |\n| ------------ | ------------------------------------------------------------------------------------------------- |\n|              | **\\*initialValue** can be any type. Mutable or immutable. Excluding a function type.              |\n|              | You don't need to set initialValue at the beginning and if you do, you can change its type later. |\n| ⚠️           | initialValue can not be a function.                                                               |\n\n| stateSettings          | object - optional                                                                                                                                                                                                                                                                  |\n| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| immutableKeyName       | **should be a string**. usePxaState converts immutable data to mutable. By this way you can handle string, boolean etc. Immutable types uses immutableKeyName to place.Immutable types are located under the immutableKeyName prop within the state. The default value is ‘value’. |\n| changeListener         | **should be a function**. If anything is changed in the state, changeListener function is triggerred. changeListener function gets 3 props: (keys, latestValues, previousValues)=>{}                                                                                               |\n| … additional functions | You can add your additional functions inside stateSettings. pxaState pushes existing state first, then other args. Check out examples above.                                                                                                                                       |\n\n> useSetContext(**contextFile**, **setFunction**,**argFunction**)\n\n| initialValue | any - optional                                                                                    |\n| ------------ | ------------------------------------------------------------------------------------------------- |\n|              | **\\*initialValue** can be any type. Mutable or immutable. Excluding a function type.              |\n|              | You don't need to set initialValue at the beginning and if you do, you can change its type later. |\n| ⚠️           | initialValue can not be a function.                                                               |\n\n| stateSettings          | object - optional                                                                                                                                                                                                                                                                  |\n| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| immutableKeyName       | **should be a string**. usePxaState converts immutable data to mutable. By this way you can handle string, boolean etc. Immutable types uses immutableKeyName to place.Immutable types are located under the immutableKeyName prop within the state. The default value is ‘value’. |\n| changeListener         | **should be a function**. If anything is changed in the state, changeListener function is triggerred. changeListener function gets 3 props: (keys, latestValues, previousValues)=>{}                                                                                               |\n| … additional functions | You can add your additional functions inside stateSettings. pxaState pushes existing state first, then other args. Check out examples above.                                                                                                                                       |\n\n> const **argObj** = usePxaContext(**contextFile**, **argFunction**)\n> const {**val1, val2, fn1, fn2, set**} = usePxaContext(**contextFile**, **s=>[s.val1,sval2,s.fn1,s.fn2, s.set]**)\n\nOR alternatively,\n\n> const **argObj** = usePxaContext(**contextFile**, **argStr**)\n> const {**val1, val2, fn1, fn2, set**} = usePxaContext(**contextFile**, **`val1,val2,fn1,fn2,set`**)\n\n| argFunction | function - mandatory                                                                                               |\n| ----------- | ------------------------------------------------------------------------------------------------------------------ |\n|             | argFunction gets desired values from state. To use pxa-state effectively, you should only fetch the data you need. |\n\n# Other Props\n\nIf needed, You can access original zustand and immer functions via pxa-state.\n\n```js\nimport { create } from \"pxa-state\";\nimport { produce, freeze, current, original } from \"pxa-state\";\nimport { useImmer, useImmerReducer } from \"pxa-state\";\n```\n\n# Updates\n\n## 0.0.48\n\n-   usePxaContext is updated. Now, string keys is an option to function keys.\n\n```js\nusePxaContext(contextFile, `level1,level2.level21,level3`);\nusePxaContext(contextFile, (s) => [s.level1, s.level2.level21, s.level3]);\n```\n\n-   Bug fix at get and getPrevious methods.\n\n## 0.0.47\n\n-   usePxaContext is updated. Now a nested call can be used.\n\n## 0.0.44\n\n-   useSetContext method is added. Using **reSet** is much more easier now.\n\n## 0.0.42\n\n-   usePrepareContext is removed. Instead use **reSet** method.\n-   previousValues are added to changeListener.\n-   Couple of bug fixes.\n-   CodeSandBox demos are added to README.\n\n## 0.0.40\n\n-   usePrepareContext is added. Now, you can set a context inside a React component.\n-   changeListener is added.\n-   getPrevious method is added.\n-   Jest tests are added. Check out gitHub repo for details.\n-   set is updated.\n\n## 0.0.30\n\nFirst public release\n\n# Credits\n\n[ThePxa Creative](https://www.thepxa.co.uk/) | [Baris Kuran](https://www.bariskuran.com/)\n\n# Dependencies\n\n[Immer](https://github.com/immerjs/immer) | [Zustand](https://github.com/pmndrs/zustand)\n\n# License\n\nMIT\n","readmeFilename":"README.md","homepage":"https://www.thepxa.co.uk/","license":"MIT"}