{"_id":"@adil-01/persistent-state","_rev":"3-f347a99a5440834e91ae5335f45fb03c","name":"@adil-01/persistent-state","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@adil-01/persistent-state","version":"1.0.0","description":"Persistent state for react and next js application with client and server side rendering capabilities","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/adil-01/persistent-state.git"},"keywords":["persistent-state","react","next","useState"],"author":{"name":"Adil"},"license":"ISC","peerDependencies":{"react":"17.0.2","react-dom":"17.0.2"},"bugs":{"url":"https://github.com/adil-01/persistent-state/issues"},"homepage":"https://github.com/adil-01/persistent-state#readme","gitHead":"b92f1090429ec5dfc99fe4ec1fa2597b10c2a0b5","_id":"@adil-01/persistent-state@1.0.0","_nodeVersion":"16.13.1","_npmVersion":"8.1.2","dist":{"integrity":"sha512-f3jEPD9Hvql0Hf+VYf5UpMR3mvMMeKOeF+JsZIrONkVjsCQXD9gIa1k4fo2laKilcOrlHxqo3Rz/r4bs7XiT1A==","shasum":"6ae9a11e8519478188552163fcad7886d0e1e0ba","tarball":"https://registry.npmjs.org/@adil-01/persistent-state/-/persistent-state-1.0.0.tgz","fileCount":3,"unpackedSize":2255,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh5UUpCRA9TVsSAnZWagAA0RwP/1ZJQ0IaXjm8xlnUVcpB\nOrd3xCz78w6kTEjtcgZc/YeG5zr71bhE8N4KQFccoxzpx+ifz98ck2UE/uto\nQAFM4YhJtsiuqyCw81TWOzlnkc16D62jJ7tWC1XHX64nBCwJTjWnacPu5+vL\nWj5cmW9D5HNdv56DxeSvLlLzbRUovygsxdbTirAnnMXwmXjIaSoJDhzOGoQ8\nAJoPHAzCQw/zYG9qVrPNfu2oAh7xF6gLgRw1KddoKBSM3OiUI7z0ShLWA97U\nrbPN9hxLwRCk+eWEk4UWzYOWSoRL66pZnNs7XbtLadgaQHIsFHoVoSfD4jNl\nj92cgSq0jJWO8o9hWA8hlqW5h/JAghg4FVutET5Uyq1nr/QbnWPKNHz7yUrZ\nEOPTphQgnOGHzvFPCWJ57CHcQi3PjjJkm+qab1bXadixz4tueAz1NU97GAeb\nr3xFNBEeBZNP6gMdEvJymVAYGhyhb0v0kg2PEg9DlsnbdXkAhaUnBSgQtrsP\nYsFrldPPrCzOocJTpnaOSVAQGjeVnYazEsfGWM1iFqMOPU+E7WiRjlBrvDcI\nn0IygVSuop4CuJHYOvmVRfsZdCrswoY4M2JM+sc2WadHh4yfGjfk2gjtDN2C\nivbEb3uEYCVT/eKckV/HPYgQK5uDAMdyQjvH9CgkLDt7+zcVAcrHvJqS0mSL\npMeE\r\n=eQ06\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDqV3NSFcfdt9FeTobNwZ0a6oen1S4Vn9Lm3TVPCJZmvQIgCPTkATbs3w/nNOpQcwPBPo0cKpTPEpuzIMoUgRzlwGg="}]},"_npmUser":{"name":"adil-01","email":"adilbacker11@gmail.com"},"directories":{},"maintainers":[{"name":"adil-01","email":"adilbacker11@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/persistent-state_1.0.0_1642415401130_0.5636460211987551"},"_hasShrinkwrap":false},"1.0.1":{"name":"@adil-01/persistent-state","version":"1.0.1","description":"Persistent state for react and next js application with client and server side rendering capabilities","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/adil-01/persistent-state.git"},"keywords":["persistent-state","react","next","useState"],"author":{"name":"Adil"},"license":"ISC","peerDependencies":{"react":"17.0.2","react-dom":"17.0.2"},"bugs":{"url":"https://github.com/adil-01/persistent-state/issues"},"homepage":"https://github.com/adil-01/persistent-state#readme","gitHead":"3a566f64acb2a2e92e5caad944a4350da4ae84c5","_id":"@adil-01/persistent-state@1.0.1","_nodeVersion":"16.13.1","_npmVersion":"8.1.2","dist":{"integrity":"sha512-5xJTACyF3iM15rgKRdxrhzC79L3dje2dw60mNgF+2vJ7vjOqvdGcDzhzmK/qBPS7Zq6AotgGcSn1OZ/RLbYQ2g==","shasum":"6dc30794ac109418f6370ecd802d77cd1d010a78","tarball":"https://registry.npmjs.org/@adil-01/persistent-state/-/persistent-state-1.0.1.tgz","fileCount":3,"unpackedSize":4176,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh5VuJCRA9TVsSAnZWagAADXIP/joo8rK207iw5RJnUMAK\nDVz+KVEWodLg4RDWGXUGwgBvNBQpautOAr4m/AHFJLlMS9unfW9TdhHUtaky\npkPLK00Lo85N3MQACFB7qWAo0m1P6cD2Uuag7i3bIasHoGk1GDTgreJ+gHwt\noTxLqi8QhufJAkWhh9nDmjp3akHTzmhXhHVTJjVFgmJ3pfIsaybipD00HM4Q\nO5flOX/cP8ImyBbEg30qBeMJHr8o+q3lQcixtetdLq/Tkw1YmrHTsXYX/LiF\n2yvOGXY+lvoMVgpdk/TFOten93N7mLvHUa+FRe0uph324mh8aqD6yzhWk1cz\n28D9GqyGyxKxI2nhJ/P1u+zadJu7UdTuvHYG40Pl7uemPiya3pcGqAjyrfij\n//irUAOhffAis6gxMR+1cRrxFG9l6o9eDOAikUZ6KjODgQhn17rEZ6s8GsVP\nS8wYPOmauHfmABMn2UcCpTArv6hMReqqkUgFfRg+qwIFEnTo/tbqb+8WEhWQ\nBIbfJ3b8V1TcjKGa2WViT8jwW87QEW2V72c2I7R+Ota8z1Wd2tpLqYsQzo3C\nB06h5+OxyBUKMWj0t12gtcG+UOyWOU2aZjCGWFCR6FPagNcMhcP8TbWRSKgN\nrVT82UWgUoP9P9o6Eb3eDUO1sNd7pkU+dg7Hlc/pf99Rd32PZGajIGCdFYqU\n5t7Q\r\n=VI/x\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDiAk4CzY4BwalciZCVUPh0RH+N8nmT+bLYcP4E39l7gQIhAJQjpk/LXp5LSxtIZLRMEmciYKSrNYLBiBcbU4g3M7n3"}]},"_npmUser":{"name":"adil-01","email":"adilbacker11@gmail.com"},"directories":{},"maintainers":[{"name":"adil-01","email":"adilbacker11@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/persistent-state_1.0.1_1642421128935_0.454791094041767"},"_hasShrinkwrap":false},"1.0.2":{"name":"@adil-01/persistent-state","version":"1.0.2","description":"Persistent state for react and next js application with client and server side rendering capabilities","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/adil-01/persistent-state.git"},"keywords":["persistent-state","react","next","useState"],"author":{"name":"Adil"},"license":"MIT","dependencies":{"react":"17.0.2","react-dom":"17.0.2"},"bugs":{"url":"https://github.com/adil-01/persistent-state/issues"},"homepage":"https://github.com/adil-01/persistent-state#readme","gitHead":"b1eb8793f00123d91a69006a9db9710ff32a574f","_id":"@adil-01/persistent-state@1.0.2","_nodeVersion":"16.13.1","_npmVersion":"8.1.2","dist":{"integrity":"sha512-hvtiDr6UUde+gGZHRAOV1jW0YowfroJEhHbcLQeAAd8ljB4axPj8fzPsSrWxwl1xlxPy/VHSZlPd8FzR36HDjw==","shasum":"a3730c7c1e96d8840d8a6c3ad841d22070cd5200","tarball":"https://registry.npmjs.org/@adil-01/persistent-state/-/persistent-state-1.0.2.tgz","fileCount":4,"unpackedSize":5254,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh5YGACRA9TVsSAnZWagAAaHwP/0DH21ZAfeGQiFHvgF/i\nJktFK9MPLlLVwByLVyMtL4HGgbxcagdRSaARnsgGCyx2fk4J4bQFSQPPX9qb\nY7cJ4cAa4FwzYX9w/49wGjSF+d8C/1xikC0nLAF8xfnw/jwsscaxolw3zFWt\nYu3ATThJ2qL/irXPOgkq6HCcCUvzmSURnP/tSr0zmpZau/gGUdih3I4WEMhI\nIkLiN1N2+dwwULgwKCwxApcn5XqTctAefD9DylxmN4GAB4Vw+inOKtbt2a12\nodpQjYwOF819R1lbqFDFNhqn0kSGa5bwWO7HDyzRrcSYH7pN8Xjp7yP4o7r9\nGLBruhzmLCCj6VidWfyClelGFDA6Toarb8Gz9uLXL7Dmp2lFDlOx0y+zlM1k\nhidCGqoppheoRuJna8tk6XuHzRwGybICooJkwpoSzc9WHE2U2wrCWop+z2JO\n4g2425W7KPu8hBAYFD59HhwPX1UF+TJcqyVL4nijlJhDJpcLDdEO5lFXkwR6\nbNBGgbxwYEhc/suMuD4/yF5XvzNX/l2znakAJf49ExqYY0cPfsSeNhWgOHsR\nIVwIV+laOZqSq+LzhP9FNjgYrMb0kE3BlUskkNPs2Q8uSwBiou13D19IqiCc\nyiYvBVxFrn6/ICcIS5QYgEbOLJTU/UMeOCszLXdHo7pl+bn3SdvdgziYehsx\nBC4O\r\n=T9D3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD8Og2SiMl53Na7a4tiadB/ZrY099/8rXse7iE4VQWwhgIgeDLilezEg1WtmfLFR0HKp2c/a0ASuzKHqhYYVsxlkVU="}]},"_npmUser":{"name":"adil-01","email":"adilbacker11@gmail.com"},"directories":{},"maintainers":[{"name":"adil-01","email":"adilbacker11@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/persistent-state_1.0.2_1642430847980_0.8947743499912559"},"_hasShrinkwrap":false}},"time":{"created":"2022-01-17T10:30:01.084Z","1.0.0":"2022-01-17T10:30:01.285Z","modified":"2022-04-04T11:30:08.627Z","1.0.1":"2022-01-17T12:05:29.057Z","1.0.2":"2022-01-17T14:47:28.159Z"},"maintainers":[{"name":"adil-01","email":"adilbacker11@gmail.com"}],"description":"Persistent state for react and next js application with client and server side rendering capabilities","homepage":"https://github.com/adil-01/persistent-state#readme","keywords":["persistent-state","react","next","useState"],"repository":{"type":"git","url":"git+https://github.com/adil-01/persistent-state.git"},"author":{"name":"Adil"},"bugs":{"url":"https://github.com/adil-01/persistent-state/issues"},"license":"MIT","readme":"# persistent-state\nPersistent state for react and next js application with client and server side rendering capabilities\n\n## Setup\n\n### Installation\nIn your terminal type.\n```\nnpm i @adil-01/persistent-state\n```\nIn your package.json file you can view the new added package **[@adil-01/persistent-state](https://www.npmjs.com/package/@adil-01/persistent-state)**\n\n### Usage\n\n**```usePersistServer``` takes 3 arguements.**\n- **key :** name of the state in your project must be a uniquie key.\n- **dafaultVal :** Intial value or default value where ```usePersistServer``` falls down if state is not persisted yet.\n- **duration :** Expiry in minutes upto which ```usePersistServer``` state is persisted.\n\nIn your react or next js project import the custom persistent hook\n```javascript\nimport { usePersistServer } from '@adil-01/persistent-state';\n```\n\nCalling the persistent state hook in your required file\n```javascript\nconst [persistedState, setPersistedState] = usePersistServer('my_string', '', 5); \n```\n```persistedState``` with name **my_string** can store **string** as we given default value as empty string and it will persist for **5 minutes**\n\nUpdating new value is same as using normal **useState** in react\n```javascript\nsetPersistedState('new_string');\n```\n\n## Examples\n\n### Datatype - Number\n```javascript\nconst [persistedState, setPersistedState] = usePersistServer('my_number', 100, 7); \n```\n```persistedState``` with name **my_number** can store **number** as we given default value as 100 and it will persist for **7 minutes**\n\n### Datatype - Array\n```javascript\nconst [persistedState, setPersistedState] = usePersistServer('my_array', [], 15); \n```\n```persistedState``` with name **my_array** can store **array** as we given default value as [] and it will persist for **15 minutes**\n\n___\n\n> JavaScript objects are not supported for ```usePersistServer``` as a state in current version, will be supported in newer versions\n","readmeFilename":"README.md"}