{"_id":"staged-components","_rev":"2838869","name":"staged-components","description":"Make React function component staged.","dist-tags":{"latest":"1.1.3"},"maintainers":[{"name":"awmleer","email":""}],"time":{"modified":"2022-09-06T15:45:57.000Z","created":"2019-11-06T07:55:29.575Z","1.1.3":"2022-05-27T03:30:29.436Z","1.1.2":"2021-10-27T03:10:22.276Z","1.1.1":"2020-11-24T07:20:28.655Z","1.1.0":"2020-11-17T09:42:53.859Z","1.0.0":"2019-11-06T07:55:29.575Z"},"users":{},"author":{"name":"awmleer","email":"awmleer@icloud.com"},"repository":{"type":"git","url":"git+https://github.com/awmleer/staged-components.git"},"versions":{"1.1.3":{"name":"staged-components","version":"1.1.3","scripts":{"build":"gulp prebuild && tsc","test":"jest"},"description":"Make React function component staged.","keywords":["react"],"main":"index.js","repository":{"type":"git","url":"git+https://github.com/awmleer/staged-components.git"},"author":{"name":"awmleer","email":"awmleer@icloud.com"},"license":"MIT","private":false,"devDependencies":{"@testing-library/jest-dom":"^4.0.0","@testing-library/react":"^8.0.1","@types/jest":"^24.0.15","@types/react":"^16.8.6","gulp":"^4.0.2","gulp-clean":"^0.4.0","jest":"^24.8.0","react":"^16.8.6","react-dom":"^16.8.6","ts-jest":"^24.0.2","typescript":"^3.5.2","use-debounce":"^2.1.0"},"peerDependencies":{"react":"^16.8.0 || ^17.0.0 || ^18.0.0"},"publishConfig":{"registry":"https://registry.npmjs.org"},"types":"./index.d.ts","gitHead":"6d5ba5bf924a511edfc4d4f206f0d58536cd0151","bugs":{"url":"https://github.com/awmleer/staged-components/issues"},"homepage":"https://github.com/awmleer/staged-components#readme","_id":"staged-components@1.1.3","_nodeVersion":"16.14.2","_npmVersion":"8.5.0","dist":{"shasum":"bb5a396df2d9b48fbc31841a59f53437ed8b8ac6","size":2299,"noattachment":false,"key":"/staged-components/-/staged-components-1.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/staged-components/download/staged-components-1.1.3.tgz"},"_npmUser":{"name":"awmleer","email":"awmleer@icloud.com"},"directories":{},"maintainers":[{"name":"awmleer","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/staged-components_1.1.3_1653622229191_0.9421982401568079"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-05-27T03:30:38.698Z","publish_time":1653622229436,"_cnpm_publish_time":1653622229436},"1.1.2":{"name":"staged-components","version":"1.1.2","scripts":{"build":"gulp prebuild && tsc","test":"jest"},"description":"Make React function component staged.","keywords":["react"],"main":"index.js","repository":{"type":"git","url":"https://github.com/awmleer/staged-components"},"author":{"name":"awmleer","email":"awmleer@icloud.com"},"license":"MIT","private":false,"devDependencies":{"@testing-library/jest-dom":"^4.0.0","@testing-library/react":"^8.0.1","@types/jest":"^24.0.15","@types/react":"^16.8.6","gulp":"^4.0.2","gulp-clean":"^0.4.0","jest":"^24.8.0","react":"^16.8.6","react-dom":"^16.8.6","ts-jest":"^24.0.2","typescript":"^3.5.2","use-debounce":"^2.1.0"},"peerDependencies":{"react":"^16.8.0 || ^17.0.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 awmleer\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":"staged-components@1.1.2","dist":{"shasum":"519654629517b2ed6abfd7758b3b8f5dbb616f91","size":2309,"noattachment":false,"key":"/staged-components/-/staged-components-1.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/staged-components/download/staged-components-1.1.2.tgz"},"_npmUser":{"name":"awmleer","email":"awmleer@icloud.com"},"directories":{},"maintainers":[{"name":"awmleer","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/staged-components_1.1.2_1635304222153_0.580451202145766"},"_hasShrinkwrap":false,"publish_time":1635304222276,"_cnpm_publish_time":1635304222276,"_cnpmcore_publish_time":"2021-12-16T12:33:41.341Z"},"1.1.1":{"name":"staged-components","version":"1.1.1","scripts":{"build":"gulp prebuild && tsc","test":"jest"},"description":"Make React function component staged.","keywords":["react"],"main":"index.js","repository":{"type":"git","url":"https://github.com/awmleer/staged-components"},"author":{"name":"awmleer","email":"awmleer@icloud.com"},"license":"MIT","private":false,"devDependencies":{"@testing-library/jest-dom":"^4.0.0","@testing-library/react":"^8.0.1","@types/jest":"^24.0.15","@types/react":"^16.8.6","gulp":"^4.0.2","gulp-clean":"^0.4.0","jest":"^24.8.0","react":"^16.8.6","react-dom":"^16.8.6","ts-jest":"^24.0.2","typescript":"^3.5.2","use-debounce":"^2.1.0"},"peerDependencies":{"react":"^16.8.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 awmleer\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":"staged-components@1.1.1","dist":{"shasum":"9e097e3ffa4677ef8d90cde2aff0d953db40ef68","size":2319,"noattachment":false,"key":"/staged-components/-/staged-components-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/staged-components/download/staged-components-1.1.1.tgz"},"_npmUser":{"name":"awmleer","email":"awmleer@sparker.xyz"},"directories":{},"maintainers":[{"name":"awmleer","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/staged-components_1.1.1_1606202428498_0.5255633775698336"},"_hasShrinkwrap":false,"publish_time":1606202428655,"_cnpm_publish_time":1606202428655,"_cnpmcore_publish_time":"2021-12-16T12:33:41.617Z"},"1.1.0":{"name":"staged-components","version":"1.1.0","scripts":{"build":"gulp prebuild && tsc","test":"jest"},"description":"Make React function component staged.","keywords":["react"],"main":"index.js","repository":{"type":"git","url":"https://github.com/awmleer/staged-components"},"author":{"name":"awmleer","email":"awmleer@icloud.com"},"license":"MIT","private":false,"devDependencies":{"@testing-library/jest-dom":"^4.0.0","@testing-library/react":"^8.0.1","@types/jest":"^24.0.15","@types/react":"^16.8.6","gulp":"^4.0.2","gulp-clean":"^0.4.0","jest":"^24.8.0","react":"^16.8.6","react-dom":"^16.8.6","ts-jest":"^24.0.2","typescript":"^3.5.2","use-debounce":"^2.1.0"},"peerDependencies":{"react":"^16.8.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 awmleer\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":"staged-components@1.1.0","dist":{"shasum":"cd9467a485474314cb29364b160620eb1b9100f6","size":2237,"noattachment":false,"key":"/staged-components/-/staged-components-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/staged-components/download/staged-components-1.1.0.tgz"},"_npmUser":{"name":"awmleer","email":"awmleer@sparker.xyz"},"directories":{},"maintainers":[{"name":"awmleer","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/staged-components_1.1.0_1605606173712_0.24472317138881627"},"_hasShrinkwrap":false,"publish_time":1605606173859,"_cnpm_publish_time":1605606173859,"_cnpmcore_publish_time":"2021-12-16T12:33:41.853Z"},"1.0.0":{"name":"staged-components","version":"1.0.0","scripts":{"build":"gulp prebuild && tsc","test":"jest"},"description":"Make React function component staged.","keywords":["react"],"main":"index.js","repository":{"type":"git","url":"https://github.com/awmleer/staged-components"},"author":{"name":"awmleer","email":"awmleer@icloud.com"},"license":"MIT","private":false,"devDependencies":{"@testing-library/jest-dom":"^4.0.0","@testing-library/react":"^8.0.1","@types/jest":"^24.0.15","@types/react":"^16.8.6","gulp":"^4.0.2","gulp-clean":"^0.4.0","jest":"^24.8.0","react":"^16.8.6","react-dom":"^16.8.6","ts-jest":"^24.0.2","typescript":"^3.5.2","use-debounce":"^2.1.0"},"peerDependencies":{"react":"^16.8.0"},"licenseText":"MIT License\n\nCopyright (c) 2019 awmleer\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":"staged-components@1.0.0","dist":{"shasum":"29e862d92d987c70695444e37fcefacf14a196b8","size":2159,"noattachment":false,"key":"/staged-components/-/staged-components-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/staged-components/download/staged-components-1.0.0.tgz"},"maintainers":[{"name":"awmleer","email":""}],"_npmUser":{"name":"awmleer","email":"awmleer@sparker.xyz"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/staged-components_1.0.0_1573026929475_0.24506977330378965"},"_hasShrinkwrap":false,"publish_time":1573026929575,"_cnpm_publish_time":1573026929575,"_cnpmcore_publish_time":"2021-12-16T12:33:42.075Z"}},"readme":"# Staged Components\n\nMake React function component staged.\n\n## Install\n\n```bash\nyarn add staged-components\n# or\nnpm install --save staged-components\n```\n\n## Usages\n\nReact Hook is awesome, but it has some kind of rules. One of these rules is [\"Only Call Hooks at the Top Level\"](https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level).\n\nSo the component below will cause an error:\n\n```jsx\nconst App = function(props) {\n  if (props.user === undefined) return null\n  const [name, setName] = useState(props.user.name)\n  // React Hook \"useState\" is called conditionally. React Hooks must be called in the exact same order in every component render. Did you accidentally call a React Hook after an early return?\n  return (\n    <input value={name} onChange={(e) => {setName(e.target.value)}}/>\n  )\n}\n```\n\nWith `staged-components`, you can safely \"break\" this rule:\n\n```jsx\nconst App = staged((props) => { // stage 1\n  if (props.user === undefined) return null\n  return () => { // stage 2\n    const [name, setName] = useState(props.user.name)\n    return (\n      <input value={name} onChange={(e) => {setName(e.target.value)}}/>\n    )\n  }\n})\n```\n\n## Advanced\n\nUsage with `forwardRef`:\n\n```jsx\nconst App = forwardRef(staged((props, ref) => {\n  if (props.user === undefined) return null\n  return () => {\n    useImperativeHandle(ref, () => 'hello')\n    return (\n      <h1>{props.user.name}</h1>\n    )\n  }\n}))\n```\n","_attachments":{},"homepage":"https://github.com/awmleer/staged-components#readme","bugs":{"url":"https://github.com/awmleer/staged-components/issues"},"license":"MIT"}