{"_id":"use-descendants","_rev":"17-b72d0d920096e350c86f0ec5294952dd","name":"use-descendants","dist-tags":{"latest":"0.0.4","beta":"1.0.0-beta.9"},"versions":{"0.0.1":{"name":"use-descendants","version":"0.0.1","license":"MIT","main":"./dist/index.js","module":"./dist/index.modern.js","source":"./index.js","scripts":{"build":"microbundle --compress --no-sourcemap"},"devDependencies":{"microbundle":"^0.12.3"},"peerDependencies":{"react":"^16.13.1","react-dom":"^16.13.1"},"description":"> Warning: useDescendants is experimental and primarily intended for personal use. It heavily relies on refs and the DOM and likely will not be concurrent mode compatible.","_id":"use-descendants@0.0.1","dist":{"shasum":"15cf9ff5aeee9199d9c148e6c3c2810805f2334f","integrity":"sha512-K3D7MQb62g4wx5oYtKtqa4w76AhrtQYfLMgvyxU0A/7OdXS1x00bqJE0iEe1Ls6lvQEC78YAPOzx4kvlfqmOkw==","tarball":"https://registry.npmjs.org/use-descendants/-/use-descendants-0.0.1.tgz","fileCount":7,"unpackedSize":11963,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfYCGGCRA9TVsSAnZWagAA0WUP/A2JYcDPP7SckXy0YgKb\nPELcjWrNbZDUT90L8De1liGtQB0CjPBpWYnLmENH2wdLXn+zhJ2FR/MskIRj\n3sJKi4HEvMMkW4YyjokQA+OX23mFb8450wMe57l2/gAceR0uDhElkTXychkb\nCVtKUxJ5/x/zZF2moKnH0NiYHazyDb1OrRHZslMp/opB4l5Qa1O6e3aE2I6q\ntYwgsqHe4MPR2WxWIiDiiNzPD+JtbfmCD2fUhJ+s8QaniP26vfIXXITOmXTC\nS4yuMrSwvPDkGwhrrP0UzP4xbzcqeWrxUPb5j1zpWKH3pT6PcqVfADZSJazv\nMWaoaUV86yRectbnxe3i65NArAlfOWiRtQIJWvI36ShVRRZ/AM79+dMaErjS\ndIpa+bTgwr7hzZll4p3rxOK2VSMvC3p52BJx6xXii89KgdebjXiBXUp1zCdL\nOH+bhjbwzYDeTVC9Y/OUVrOWZs5WezyfYjV6Lraz3M2ULgKjT1volXYmgCQp\n888PaajErOcCxOFJvW4X7bI3UYE8o/BH7bxg8qk0HXSGfpDMnCFhnLd3Ggta\ncaL6ZC7wxlpuaEobCjttKqsRKw1R0nx63YdV05ajVyfqThbZrNjYhk11kXqp\nBmVX6FYLL0dqei3jL/IoyCvKtoXbng3VBQGVEi3+MM7Mq8cg/qP0xxG+mEuc\niMS5\r\n=iEV4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFhEf7ZbWCIH2bdKQc3vI/Rv7P6wWT9KP1tpUSB/dGvJAiEAzdu7TEGiAvdu4vGtZmfWhCmDZ6aEn1iv/YfdnOYnAgg="}]},"maintainers":[{"name":"paco","email":"pvco.coursey@gmail.com"}],"_npmUser":{"name":"paco","email":"pvco.coursey@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-descendants_0.0.1_1600135558373_0.9996646629234907"},"_hasShrinkwrap":false},"0.0.2":{"name":"use-descendants","version":"0.0.2","license":"MIT","main":"./dist/index.js","module":"./dist/index.modern.js","source":"./index.js","scripts":{"build":"microbundle --compress --no-sourcemap"},"devDependencies":{"microbundle":"^0.12.3"},"peerDependencies":{"react":"^16.13.1","react-dom":"^16.13.1"},"description":"> Warning: useDescendants is experimental and primarily intended for personal use. It heavily relies on refs and the DOM and likely will not be concurrent mode compatible.","_id":"use-descendants@0.0.2","dist":{"shasum":"374aa8c192d63ddebd00e124632bfe151b7a1f5c","integrity":"sha512-PhtWKgriuN6YHz0TcEjcSUT8vyFJ4kwCyt1uG2fRetfkvncMMG6/6u6s9gi2RswDgnSNHqMzCvVP1QiQ/SRwAA==","tarball":"https://registry.npmjs.org/use-descendants/-/use-descendants-0.0.2.tgz","fileCount":7,"unpackedSize":12287,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgmufDCRA9TVsSAnZWagAAPpgP/1diS+gwHV+vmzko0XRR\neuOEhzNv+fLmLGN/+lH6nOVSk3269RK5tNAlcA8ieWOgUT8ZC4dDIXabP5fR\nj3PVcFCj/uyeKNQjQqd4kgDKynCDpA6nm/wuwMAO25k3meRCRW+cYgk0H2Oq\n9m+hmsOr9mNHm1XnkLYT6uldDz+TnWY8zPqzL78gWR5D73ui1hH9ulVCK6D1\nCPWuqJ5bngCrzlwxN1TRrjrMWgwpWAlEsJ17zKrPs2FA6qQIsQ+ynrIvtOvI\nUszxLMIaNRoy5L29WKMUJxg9NGj/RBsELlV4nG+yWAlIjc++ZpJepTfPoqV5\n674t6NV7BbZ3GjqinnYshGIAY19Gn4sundDvmtPUOnEH/M+jIhYSgHOA4Fwt\nKlwVJfERbqr3/CK3Db6quzqaLHO8px5HfpKplK8zUMvDzWB75Jg2YMpMPYSo\nABc/ityCWp0CCYDrGFSaW0GhGLItgwscI9n7aP04vM4CDw3mUKhuN+KaQ4cr\naBoro8tmslftVvAMhzNTKDFzYC4Z/T7ykFO9PL7BjaYCaOTpr1VN5RupN+dS\nCZIWfD9KrE1W/ZX+eJCp5PliwdZYgo3U2/MFxll1EUfAf+25E7W2F2704+zW\nyHl3lNezdPe9hUOBdNw94dfw4UgPCLjOGqaD2bkCYkztYSGxLa51hPJ+MSoR\nwwiQ\r\n=bdcj\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC4bL+h+0yxjILtk2GSOAC1xsTnCFaO+vqUjE6IXylO4wIgDGFIZkDo04gHUn1QnelSsHcji/4R5oVF6/7MQw9uWDs="}]},"_npmUser":{"name":"paco","email":"pvco.coursey@gmail.com"},"directories":{},"maintainers":[{"name":"paco","email":"pvco.coursey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-descendants_0.0.2_1620764610777_0.04808228927757918"},"_hasShrinkwrap":false},"0.0.2-beta.0":{"name":"use-descendants","version":"0.0.2-beta.0","license":"MIT","main":"./dist/index.js","module":"./dist/index.modern.js","source":"./index.js","scripts":{"build":"microbundle --compress --no-sourcemap"},"devDependencies":{"microbundle":"^0.12.3"},"peerDependencies":{"react":"^16.13.1","react-dom":"^16.13.1"},"description":"> Warning: useDescendants is experimental and primarily intended for personal use. It heavily relies on refs and the DOM and likely will not be concurrent mode compatible.","_id":"use-descendants@0.0.2-beta.0","dist":{"shasum":"68ce22a0b6e480b71c3f98f3d669443fd5c48ce4","integrity":"sha512-PdSYqwXwG0U0X9Rj5ZVaj25jLmPDzXBxZSlZiOCieFyskLiB7ABhLf4ddTp9fyobvebrHU8dNW5ZTBkQb7Tsqw==","tarball":"https://registry.npmjs.org/use-descendants/-/use-descendants-0.0.2-beta.0.tgz","fileCount":7,"unpackedSize":12294,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg3zJkCRA9TVsSAnZWagAAaCkP/0rtjgjii9c075ofytXu\n1TPyDnmCTmQA6qBMXQOlT6L57M0qs57+H4y1a1w8MI3AZQ/Bb9rdbTB3iJH1\nBFVX4oR/i7OwyhBIibcgGO9XJXqVf8QN45QQwl8liLtmr8CG3dWheLuBiQyi\nB8OoVutX6O/x7Z0DIscN/FLmQ0sZBXFsu/p65c9VnL1CZAYww3fyh1fR1tta\n3uMhirDFPxmqt065qrz97WQZItTU+B1Y5sO2jC8+1yQ2QDpkjn1vYDAg2poz\n4a/FGTNyEaZ8zvKTiAisblwOkH6q0zfzTjFe+3uEQN0/+KjvBpc7SeJloaOn\nAmtEB60haCvKPt2VO/GKtLA+JG8mAwrzJhBYkc/Y5d92eo3vmFOCNI7iKlkR\nto7KNj75MIlVelMWaiSs55/OxKoku/X8fDmCW93HYRWgISN/1W8ZPn9cHlDQ\n5ReafugfycXMGd1jYUG0mkGQ3tMMFsTZi8lJy35lrYi5ZVSlwAmzNaiMZo/E\npqIlrV5Tl7yabUceuhiNkk88JA0sqPEB8pp/Jc/clPe5vsboSkjAJlOe991i\nnKHCQUuPQZyQc8mxwYIXdDjva/ltFDmbF0Nuvkuenen6wtF+bYXIMOg64C4h\nOhbNq7MIWFebS1I7hy25+ABERjsC3aSPqQRFiM0xVWXZwZjfZf8U0y8M+vSJ\nREH/\r\n=A/jb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHewJI7IcyQZFK6U31qq2NtCdFKA3/lRe9H+s5mDb8AHAiAzu222Sxo9DU3RrrzYEoiViub/r/EH9c0PyP1ErIWkWA=="}]},"_npmUser":{"name":"paco","email":"pvco.coursey@gmail.com"},"directories":{},"maintainers":[{"name":"paco","email":"pvco.coursey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-descendants_0.0.2-beta.0_1625240164280_0.348886662051622"},"_hasShrinkwrap":false},"0.0.2-beta.1":{"name":"use-descendants","version":"0.0.2-beta.1","license":"MIT","main":"./dist/index.js","module":"./dist/index.modern.js","source":"./index.js","scripts":{"build":"microbundle --compress --no-sourcemap"},"devDependencies":{"microbundle":"^0.12.3"},"peerDependencies":{"react":"^16.13.1","react-dom":"^16.13.1"},"description":"> Warning: useDescendants is experimental and primarily intended for personal use. It heavily relies on refs and the DOM and likely will not be concurrent mode compatible.","_id":"use-descendants@0.0.2-beta.1","dist":{"shasum":"e8c9674de5df8d42b70b2867eea1f99db4a3d6f4","integrity":"sha512-TRIgt3z8lNt7eOsvPbzQH+v8gujsnC5bp3XetenTCZ/OiYKXXnBcfBZDrFRrnbCOmdQNOPNFXTxMhcf9ZGI7Bw==","tarball":"https://registry.npmjs.org/use-descendants/-/use-descendants-0.0.2-beta.1.tgz","fileCount":7,"unpackedSize":12411,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg3zJ5CRA9TVsSAnZWagAA2moQAJKTuQ8mTpbFFE5D+35C\nOTw9U0m4q2xd1SAP5CKBE1wUwHF8gDiJKuFnkiBzqNwZxikhYHnj65+f2Vpj\nDVdl9WuaVnZ+1MOkydMAR4sU0P/IqSRuQODQW9ZSmaVHv9x/xRJ18VvK3aoW\nyrGIeoaxYkQMXPt6SZ6EnJW3+bgoAm7Z2KB/8VKILJxXCq/yI1YRZIp+1nMl\nzHDrAPLQZnv/VZRVtSen6Mi7tCYIQydR9yCQ2UsvaWZ4gz+flIZlYvp/cy9m\nQyIuua3P7dOEgb72mxWjnaWrY+IoEEhIB/RLAdu9y27l5t0SjIOCL9Mo8+3F\nH4lKMwVeIEOTizpc3eJdUZ/79w1QLNeFjRu3pg1oT5/wQzfvBE3huFShvhzE\nQdAJxt95Q/LX8Yv9zXCz8b5612B6cfe59aQRj/ekfa82B+z5BW8a5gZm4gXH\niGhdZ8XVal54p18mUOjBVOCVDIDq49vZm4ahHNQns6oOINYhY1wHmwbGVbSa\nXSQIE5EReS4pn51PLVXE1l/j2pebfBO/9aYQ0ySGS0XmPMDG5F2MR5CIzhBA\nl9ke4gtIBx78SQ6dLfqpMSA+YeVU7ndHV1a6XAZEFIKdr0PMJOpEjNarfCKN\nN/NrSIgb7l6czue3OSjtnFKVYcbMncXhdgqE1xdSlzxYwSWOV33H/PSP9J2W\nYunD\r\n=Dr97\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCyAUDufj0DLgTW1549vEejIjyU6+hp9ls2CS1k8njLXAIgTvdO5FR/bZDo3RAom9tUF/mBDPgPldILt3z8IQJYjBc="}]},"_npmUser":{"name":"paco","email":"pvco.coursey@gmail.com"},"directories":{},"maintainers":[{"name":"paco","email":"pvco.coursey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-descendants_0.0.2-beta.1_1625240184666_0.1195204946640922"},"_hasShrinkwrap":false},"0.0.3":{"name":"use-descendants","version":"0.0.3","license":"MIT","main":"./dist/index.js","module":"./dist/index.modern.js","source":"./index.js","scripts":{"build":"microbundle --compress --no-sourcemap"},"devDependencies":{"microbundle":"^0.12.3"},"peerDependencies":{"react":"^16.13.1","react-dom":"^16.13.1"},"description":"> Warning: useDescendants is experimental and primarily intended for personal use. It heavily relies on refs and the DOM and likely will not be concurrent mode compatible.","_id":"use-descendants@0.0.3","dist":{"shasum":"bf3adc9ed77879f3db22c0443f3c994d783be350","integrity":"sha512-6u6kRHPOuVePTChTSQfaHI+N8Jqxpaqqp6uK7zI3vbA/VCfWpBXbsckQiTLziRgQdjFK1OHizSZ5Yn5W577XVg==","tarball":"https://registry.npmjs.org/use-descendants/-/use-descendants-0.0.3.tgz","fileCount":7,"unpackedSize":12404,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg35CTCRA9TVsSAnZWagAAqHMP+wYBT/CkuVKj0HL4M0q9\ng2OzwbIxrmabbqvmHaO3UFmlcjliiiUOuKJIInrgz4z+Tkr/DGkFLyfDpeE4\np5aUqaEk5HSa5mO4fKOsNc+khs1Cxqsa3io/hLibYCbVGFSRh49Mh7nTpe4r\nIyk2YvfA2o2DVIuLTqyyuP+jdlfrTMZagxMY8ONYrXgmMIDPtYL+sEvcLSgZ\naDIS2XrIHJNxJOewb/jFd7ioEVb7aIvdfMb4kxwMOCCJvMH5UotIjYeJ0+h/\nGVLmQC36ltifm03+LtCcXJpJMi42Bnb1tTmUI47ILIohnBjvgN46/7COUOmT\neq86Rc9kUwwvQ/pJkkqxuOhlBK1IxaItu5AVlixHxf/q0XBapraYyQH7WerE\nF1fK61wm9c/UMJi+FMo8fWQjFSljcsBO+pQeSRYcECuiHmrXi+JZrkNBGQGy\nHRfxYRD3xk2JeqwfKhS1lnRG2MovBY2LyZlQ3WkQerG7kZRq8/9BoPzKuteG\nhniYZCyV4NOUeANmRSozusqYJZkVyxlUmyzcoIBAWLfxPKuzJWbgxhXBGMYN\nMZkad2VUgTBcGCEI+kg/a9nQ4TUEoO9H238gs8FTB2bZ5w57nybrG1kh2Kq2\n+L9B1szY4fsm41c3erPF1xpCkXO0oRVpjLJT68B+B5DXhiBNeim7uSL18nE8\no8Cq\r\n=Tnl7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDlke6xhjX7Xxjqrrv8FkNCdrnw6ZQ/p7NoLb5Q5RARNAiEArY3AxWj8Gl4kSa2dq0sJdN5VA2k/i2+6rhdAfhwo9cI="}]},"_npmUser":{"name":"paco","email":"pvco.coursey@gmail.com"},"directories":{},"maintainers":[{"name":"paco","email":"pvco.coursey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-descendants_0.0.3_1625264275205_0.5105530724696454"},"_hasShrinkwrap":false},"0.0.4":{"name":"use-descendants","version":"0.0.4","license":"MIT","main":"./dist/index.js","module":"./dist/index.modern.js","source":"./index.js","scripts":{"build":"microbundle --compress --no-sourcemap"},"devDependencies":{"microbundle":"^0.12.3"},"peerDependencies":{"react":"^16.13.1","react-dom":"^16.13.1"},"description":"> Warning: useDescendants is experimental and primarily intended for personal use. It heavily relies on refs and the DOM and likely will not be concurrent mode compatible.","_id":"use-descendants@0.0.4","dist":{"shasum":"af9310de311667468f48746014e02b3f098c715f","integrity":"sha512-txLp0rCGtGI1SbWVddK6uZQdEofvI1zzJW1aak+paBbzCenK/k2oxikixW6yu29BLDSqtBCUAh3A5MFVSVHjNQ==","tarball":"https://registry.npmjs.org/use-descendants/-/use-descendants-0.0.4.tgz","fileCount":7,"unpackedSize":12371,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2/JHCRA9TVsSAnZWagAAazoP/jkb4HUXpOwITX1sKcTB\nCMDcwpM8hj/vHcSe0QEiOpqjoxtwhV44eJQ3ssPNLnAcM3/2tHDLLLoQmsBC\n/xd62LJmQV+DDslYlCtFO6afXaWu5ykcDZ7lvq/oXA6kjgknuPhOGyHV+mZM\njXpU2sghrYjlEfyAYqTpZIyXG2CiMLbF18ckXeDhnadtOg+7vhkjoXolq4T1\n+Fz+Eaxcsewk5bdGcruIfo9aeDjXqLmN1pVXYX+w0BGOyJRKhHlSJtakNmLE\ncK93nbxdtsNM9oN3zw3f/sbfBB97x4jZmVysfl31X80TKFIDWpPrIhp6jxlr\nb+Fx9b0Wm9omK7kKbGtYF6ek2c2DZTgcHmemzvtcw2jVovlRUmJfcDBLPf5P\nALOgSorHUFEcUwAETgtPrtTBEFovLRtykS5l1rY512QyjLopYO6qmV6MaIrO\nss9nbwKkng3u3K+F9oofxXaLeRF9lXqJcvS6FNhrVBHZ+S2Iul1f8rNbqAVS\nAhFyIgdbB5hVmTotBVfcPRvSQQOZEO3kquH+/ai83nW+ifBokMA6xSUyI+wb\nMxv+P+bo0huQZoYLdM/XN1rwVGb6eu2atvT26e6Lu4j5kGMUOnJrMwaN9M6H\n61FPjZyvDcXBQSwMvYtwAM3DO5tsAt2izBpwgv2Y+dS5RD5SFan1pcHuxQPh\n9z5h\r\n=cDPi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDRLjzSiK5UVnvXD/e//2nfEcUqIxU3+HiM/k30aeuJmgIhAIchK4JLH2KZAPvP40Znttf8nTagh+ZF2/sKTdrV6dkz"}]},"_npmUser":{"name":"paco","email":"pvco.coursey@gmail.com"},"directories":{},"maintainers":[{"name":"paco","email":"pvco.coursey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-descendants_0.0.4_1625264675589_0.8814505847311271"},"_hasShrinkwrap":false},"1.0.0-beta.0":{"name":"use-descendants","version":"1.0.0-beta.0","license":"MIT","main":"./dist/index.js","module":"./dist/index.modern.js","source":"./index.js","scripts":{"prepublish":"yarn build","build":"microbundle --compress --no-sourcemap"},"devDependencies":{"microbundle":"^0.12.3"},"peerDependencies":{"react":"*","react-dom":"*"},"readmeFilename":"README.md","readme":"# useDescendants ![npm bundle size](https://img.shields.io/bundlephobia/minzip/use-descendants)\n\n> Warning: useDescendants is experimental and primarily intended for personal use. It heavily relies on refs and the DOM and likely will not be concurrent mode compatible.\n\nuseDescendants is a react hook for keeping track of descendant components and their relative indeces. It's based off the [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) package, but is much faster and half the size, with no dependencies.\n\nIf you want to understand more about what this package does or why we need it, read the [Problem Complex](https://www.npmjs.com/package/@reach/descendants) from the @reach/descendants package.\n\nIn short, this package allows each item in a list to know it's relative index and the parent of the list can keep track of each child, without needing to render in a loop and pass each component an index.\n\nThis enables component composition:\n\n```js\n<List>\n  <Item /> // I'm index 0\n  <Item /> // I'm index 1<div>\n    <div>\n      <Item /> // I'm arbitrarily nested, but still know that I'm index 2\n    </div>\n  </div>\n</List>\n```\n\n<br />\n\n## Installation\n\n```\n$ yarn add use-descendants\n```\n\n<br />\n\n## Example ([live](https://codesandbox.io/s/use-descendants-demo-wi96j?file=/src/App.js))\n\nIn this example, we'll create a menu with items that can be selected on hover.\n\n```js\nimport {\n  createDescendants,\n  useDescendants,\n  useDescendant\n} from 'use-descendants'\n\nconst DescendantContext = createDescendants()\nconst MenuContext = createContext()\n\nconst Menu = ({ children }) => {\n  const { ref, ...contextProps } = useDescendants()\n  const [selected, setSelected] = useState(0)\n\n  return (\n    <DescendantContext.Provider value={contextProps}>\n      <MenuContext.Provider value={{ selected, setSelected }}>\n        <div role=\"menu\" ref={ref}>\n          {children}\n        </div>\n      </MenuContext.Provider>\n    </DescendantContext.Provider>\n  )\n}\n\nconst MenuItem = ({ children }) => {\n  const { selected, setSelected } = useContext(MenuContext)\n  const { index, ref } = useDescendant(DescendantContext)\n\n  const isSelected = index === selected\n\n  return (\n    <div\n      role=\"menuitem\"\n      ref={ref}\n      data-selected={isSelected}\n      onMouseMove={() => setSelected(index)}\n    >\n      {children}\n    </div>\n  )\n}\n```\n\nPretty simple, right? The beauty of this API is that Menu's children can be wrapped arbitrarily, as opposed to normal rendering techniques.\n\n```jsx\n// Before\n<Menu>\n  {items.map(item => (\n    <MenuItem>{item}</MenuItem>\n  ))}\n</Menu>\n```\n\n```jsx\n// After, use any component tree\n<Menu>\n  <MenuItem>Hello</MenuItem>\n  <BlogMenuItems />\n  <RedItem>Im Red</RedItem>\n\n  <>\n    <>\n      <>\n        <MenuItem>Deep</MenuItem>\n      </>\n    </>\n  </>\n</Menu>\n```\n\n<br />\n\n## Usage\n\nThere are two hooks: `useDescendants` (used in the parent) and `useDescendant` (used in each child). You will also need to use `createDescendants` to wrap each child with context.\n\n### useDescendants\n\nMaintains state related to the list of descendants.\n\n```js\nconst { ref, ...contextProps } = useDescendants()\n\n<ul ref={ref}>\n  // ...\n</ul>\n```\n\nThe returned `ref` should be applied to the DOM element of your parent. The rest of the values returned from `useDescendants` should be passed via context.\n\nThe context props:\n\n- `list`: a ref with an array of currently rendered descendants\n- `map`: a ref with an object of every mounted (even if not rendered) descendant, keyed by component id\n- `force`: a way to forcefully re-render the parent\n\nLearn more about `list` and `map` in the [Advanced](#advanced) section.\n\n### createDescendants\n\nCreates a new descendant context.\n\n```js\nconst DescendantContext = createDescendants()\n\n<DescendantContext.Provider value={contextProps}>\n // ...\n</DescendantContext.Provider>\n```\n\nThe created context must be passed to `useDescendant` below.\n\n### useDescendant\n\nuseDescendant accepts two arguments: `context`, the context you created with `createDescendants`, and `props`, arbitrary props that you want available in the parent.\n\nAny props you pass will be available in the parent in `contextProps.map[id]`, where `id` is the component id returned below.\n\nuseDescendant returns three values:\n\n- `ref` should be applied to the DOM element of this child.\n- `index` is the relative index of this child in the list\n- `id` is the unique id of this component\n\n```js\nconst { ref, index, id } = useDescendant(context, props?)\n\n<li ref={ref}>\n // ...\n</li>\n```\n\n<br />\n\n## Why?\n\nTo enable composable APIs instead of falling back to rendering data arrays. I prefer abstractions like `<select><option /></select>` instead of `<select options={[]} />`.\n\n## Advanced\n\nuseDescendants heavily relies on refs to avoid unnecessary re-renders, which makes it about 3x faster than @reach/descendants because nothing is kept in state. We manually re-render the parent only when necessary.\n\nIt also heavily relies on the DOM. Under the hood, we use `document.querySelectorAll` to get all of the descendant DOM elements, and then keep an up-to-date list of their relative indeces.\n\nThis is because React provides no easy way of querying the component tree, and recursively checking `children` in the parent would be slow. But the DOM does provide an easy way to query the tree, and the DOM always represents the accurate state of our descendants.\n\nAnother downside of @reach/descendants was that any props passed to an item must be memoized. Passing an un-memoized function caused an infinite re-render. In useDescendants, you can pass any props, memoized or not, because we keep them in a ref.\n\n### How it works\n\nWhen a descendant is mounted, it is assigned a unique id and an index of -1. We wait for the item to mount the ref, then add the `[data-descendant]` attribute to the DOM element with the components unique id (i.e. `data-descendant=\"2h7g2b\"`)\n\nThe parent list then queries the DOM for all elements with `[data-descendant]` and compares it to our list of descendants. If they are different, we update our list and re-render the parent. This re-renders all of the descendants, who can now compare their id to the list received from the parent via context. Now each descendant knows it's relative index to other descendants.\n\nIn the parent, we can use `list` and `map` to retrieve information about each descendant. For example, if we wanted the props of the fourth descendant, we can get the descendant id from the list and use it to lookup in the map:\n\n```js\nconst id = list.current[3]._internalId\nconst props = map.current[id] // All of the props passed to `useDescendant` by the fourth descendant\n```\n\nThis makes it easy to pass data from the children back up to the parent.\n\n## Credits\n\n- [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) and [Chance](https://twitter.com/chancethedev), who introduced me to this concept\n","description":"> Warning: useDescendants is experimental and primarily intended for personal use. It heavily relies on refs and the DOM and likely will not be concurrent mode compatible.","_id":"use-descendants@1.0.0-beta.0","dist":{"shasum":"f411a9a67daf9c85ceab0a3cb53f158de61c75da","integrity":"sha512-NFsuHJf+udQ0px3E71JTgylczmWYlpLj9CcwKmxvY64rrbNqKk7JxKETTS3RXKFJVe6E2a/e9zzH3WsDVJ/QZw==","tarball":"https://registry.npmjs.org/use-descendants/-/use-descendants-1.0.0-beta.0.tgz","fileCount":7,"unpackedSize":9368,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg52QICRA9TVsSAnZWagAAMPAP/RbAYA4wPjhtwpR4cpB3\ngAx17JK/e+AJkOmLUbb7Ly0Ut9gjitga8K4gPhMKAHdZEXVX1V05YAzw+z2f\nRzUUIv/O2kqJ8ucy6xSZbfmCM8fivN36zerOnqPMJKDSDEqv9cKPTezxznGg\ndR7pOAzroVW7Z5vj4arfiUw9Gg6Tkbun4tIyeFFW1pIWsROEO9FvOg56dZ0k\nE8dOBO3LQKgDK4aBVcQF309stVqcGwbCw7RaOMig5NJ5VY36r1XAOQbfMcaQ\nm2Fh3rB71TXKWJ+KlnpGOGG5rzxqIuUqB8USiBqi2jayyMVIRn8tz63fIWmH\n8GV0+s2u2V5oqZNzw2xTxmafB8if03dXFMWc17zg825vvuRWGm7m72BziZdl\nylpsRUEXSadrAITxc1WdhuIxX6tMLAreH9dG0H+ox49KQ7EvNwbZ1VUAPVDi\n0E1Skrx5/Bs7V+k6LABg1yI7w64PQsQqOPVAX98eI7BodI9u+7JVr46Ocmrb\nQfy4u5/3u+/2sHY6TIcukiafBwD9JCuqKpxDxq9E+XTJHEtNUK0yf/z7DIOD\nPOlQB3OaKHQoZ/Lb+LIg8g8Fi9Zb5/Yk7GkOQJIuWhBcM6naQsUm94OdHgsz\nXJu4ySDdSTcgVxRZ17Don4X49JpXQs9lHfDwie2M6qTBU7v7qN0yKQqGDm44\nIlNO\r\n=9peH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDuK9LI6C0TIiHSxKLazkPD7hXd9mgsifJn4A9nG/PUhQIgVkoyikTa46sObWaQuBtiu5LsNM4Lm6LTz1lbEO9Ee6k="}]},"_npmUser":{"name":"paco","email":"pvco.coursey@gmail.com"},"directories":{},"maintainers":[{"name":"paco","email":"pvco.coursey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-descendants_1.0.0-beta.0_1625777160019_0.8548022305293694"},"_hasShrinkwrap":false},"1.0.0-beta.1":{"name":"use-descendants","version":"1.0.0-beta.1","license":"MIT","main":"./dist/index.js","module":"./dist/index.modern.js","source":"./index.js","scripts":{"prepublish":"yarn build","build":"microbundle --compress --no-sourcemap"},"devDependencies":{"microbundle":"^0.13.3"},"peerDependencies":{"react":"*","react-dom":"*"},"readmeFilename":"README.md","readme":"# useDescendants ![npm bundle size](https://img.shields.io/bundlephobia/minzip/use-descendants)\n\nuseDescendants is a react hook for keeping track of descendant components and their relative indeces. It's based off the [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) package, but faster and smaller.\n\nIf you want to understand more about what this package does or why we need it, read the [Problem Complex](https://www.npmjs.com/package/@reach/descendants) from the @reach/descendants package.\n\nIn short, this package allows each item in a list to know it's relative index and the parent of the list can keep track of each child, without needing to render in a loop and pass each component an index.\n\nThis enables component composition:\n\n```js\n<List>\n  <Item /> {/* I'm index 0 */}\n  <Item /> {/* I'm index 1 */}\n  <div>\n    <div>\n      <Item /> {/* I'm arbitrarily nested, but still know that I'm index 2 */}\n    </div>\n  </div>\n</List>\n```\n\n## Installation\n\n```\n$ yarn add use-descendants\n```\n\n## Usage\n\nIn the parent, you call `useDescendants` and pass the result to `<Descendants>` that wraps the children. In each child item, retrieve that items index with the `useDescendant` hook.\n\n```jsx\nconst Menu = () => {\n  const context = useDescendants()\n  return (\n    <Descendants value={context}>\n      <Item />\n    </Descendants>\n  )\n}\n\nconst Item = () => {\n  const index = useDescendant()\n  return <div>My index is {index}</div>\n}\n```\n\nYou can pass any data you want to `useDescendant` and it will be available in the parent through the `map` ref:\n\n```jsx\n// In Item\nconst ref = useRef()\nconst index = useDescendant({ ref })\n\n// In Menu\nconst context = useDescendants()\nconsole.log(context.map.current)\n// => { '<randomItemId>': { index: 0, props: { ref: HTMLDivElement } } }\n```\n\nYou can also pass un-memoized values or callbacks here because it's just kept in a ref:\n\n```jsx\nconst index = useDescendant({\n  onSelect: () => {\n    /* Do something */\n  }\n})\n```\n\n## Credits\n\n- [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) and [Chance](https://twitter.com/chancethedev), who introduced me to this concept\n- @shuding for help with a faster, simpler implementation\n","description":"useDescendants is a react hook for keeping track of descendant components and their relative indeces. It's based off the [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) package, but faster and smaller.","_id":"use-descendants@1.0.0-beta.1","dist":{"shasum":"9b50a7d73409705496221318fa41e5abdf194394","integrity":"sha512-bSkFWT9ZqAVuQ9TFUeBlhZTyqxs2qIRfkwnvGHQowQ+IYO9afT2TCvLGOC5bgZ68FCG7AUiNzGTJjxM5jhPxMw==","tarball":"https://registry.npmjs.org/use-descendants/-/use-descendants-1.0.0-beta.1.tgz","fileCount":7,"unpackedSize":5329,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg6ShECRA9TVsSAnZWagAAZEEP/i2EHGD0lI/R0LWPe5iG\nV2QoVqmGh8xlp46z8MO502+X+dtxa3ILH2P2f+8FwcNd4b7PsrByQ3YsQsSo\nW3Lfc+ptAcoCz99bxnu2Qr1K8yGB0r1G9r/tUbHnXK7602o0M8NYg3yfsQ6Q\nSi2a2RnX0hMaxO46lTQr9TsMHFBMIn/gTR1U8XA2QhMK8bxWfGKp9UvJWE0d\nlNX6KQD3d+2CQv6EzE2rZI/ff9rE8ZorQNKguNAan2gl8eklIpe0E1JZc1rh\n3DmyKpo4Nk1Ylp18/BXjMtKve3RjC0JbLquwzvHMKmQESKkGm6OWdhWUcTYE\nK8NKwkfMwxY4213E8WVvUjOWOkRQm7UJfqeDuCX5mqFbBXX2UEBuMwWDDv5z\nk5yPVsApgaZoJqHu46ZLqzMb656EracFgOYs2ltmgHjMSdvqeO6SefPwxarV\nBRFV6oywwMeSc7tbmMCAL6rvxSlmhl8ZWKdQ44+0J1GOXfm3GDfxuQVGC+QR\nmcYjr9EmN2BWqz2V8SXgs8BBvWxCSJME4VljBAJ0iRLlN9IHdln3x6OdP+D0\nj4z1DItGd/WEL2aMyV52Mf7Uwe4a3pVhT9XrwH+3YMZMovYg7XfzfdhdxPfe\nibelQRJisRaTY0b4f2sjU6ajXJ9hvclkbV/7H6i1JmPpVIhEAabC39eQdyTu\nmDt/\r\n=1DNd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEn5c1MnHS6ei09tMER0SHBXWP2neDIWniq01fkJb0+gAiAqASaARhnBka1rvLST33/2zSIrpeUVxcD/B2mkqW0sjA=="}]},"_npmUser":{"name":"paco","email":"pvco.coursey@gmail.com"},"directories":{},"maintainers":[{"name":"paco","email":"pvco.coursey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-descendants_1.0.0-beta.1_1625892931753_0.42398412933936225"},"_hasShrinkwrap":false},"1.0.0-beta.2":{"name":"use-descendants","version":"1.0.0-beta.2","license":"MIT","main":"./dist/index.js","module":"./dist/index.modern.js","source":"./index.js","scripts":{"prepublish":"yarn build","build":"microbundle --compress --no-sourcemap"},"devDependencies":{"microbundle":"^0.13.3"},"peerDependencies":{"react":"*","react-dom":"*"},"readmeFilename":"README.md","readme":"# useDescendants ![npm bundle size](https://img.shields.io/bundlephobia/minzip/use-descendants)\n\nuseDescendants is a react hook for keeping track of descendant components and their relative indeces. It's based off the [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) package, but faster and smaller.\n\nIf you want to understand more about what this package does or why we need it, read the [Problem Complex](https://www.npmjs.com/package/@reach/descendants) from the @reach/descendants package.\n\nIn short, this package allows each item in a list to know it's relative index and the parent of the list can keep track of each child, without needing to render in a loop and pass each component an index.\n\nThis enables component composition:\n\n```js\n<List>\n  <Item /> {/* I'm index 0 */}\n  <Item /> {/* I'm index 1 */}\n  <div>\n    <div>\n      <Item /> {/* I'm arbitrarily nested, but still know that I'm index 2 */}\n    </div>\n  </div>\n</List>\n```\n\n## Installation\n\n```\n$ yarn add use-descendants\n```\n\n## Usage\n\nIn the parent, you call `useDescendants` and pass the result to `<Descendants>` that wraps the children. In each child item, retrieve that items index with the `useDescendant` hook.\n\n```jsx\nconst Menu = () => {\n  const context = useDescendants()\n  return (\n    <Descendants value={context}>\n      <Item />\n    </Descendants>\n  )\n}\n\nconst Item = () => {\n  const index = useDescendant()\n  return <div>My index is {index}</div>\n}\n```\n\nYou can pass any data you want to `useDescendant` and it will be available in the parent through the `map` ref:\n\n```jsx\n// In Item\nconst ref = useRef()\nconst index = useDescendant({ ref })\n\n// In Menu\nconst context = useDescendants()\nconsole.log(context.map.current)\n// => { '<randomItemId>': { index: 0, props: { ref: HTMLDivElement } } }\n```\n\nYou can also pass un-memoized values or callbacks here because it's just kept in a ref:\n\n```jsx\nconst index = useDescendant({\n  onSelect: () => {\n    /* Do something */\n  }\n})\n```\n\n## Credits\n\n- [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) and [Chance](https://twitter.com/chancethedev), who introduced me to this concept\n- @shuding for help with a faster, simpler implementation\n","description":"useDescendants is a react hook for keeping track of descendant components and their relative indeces. It's based off the [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) package, but faster and smaller.","_id":"use-descendants@1.0.0-beta.2","dist":{"shasum":"7624da71c1573941d6876cf894e247213d7c40a9","integrity":"sha512-DyGwIXarDJxz8p5sjUll+aFYg4+7x8YYjvXEA6NIezarsT3c7MQkgx8IHyfg0ggG1xlEciYMcTKpEUhHYb2/Gg==","tarball":"https://registry.npmjs.org/use-descendants/-/use-descendants-1.0.0-beta.2.tgz","fileCount":7,"unpackedSize":5218,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg6SvBCRA9TVsSAnZWagAAo5QQAJIgySSptmtH8UDKPeRX\ny5hTgBnJZjtWXJQAkMWjtYeyOLFjr28lPkogUF2iCdnlPX1Q/AiYyyeQgg/J\nRhJAjtTqphgGk9/2sZs2EDgYi2j3G3bJPdwjZhvBZR/31fv7Cl7VdKIyfJ9k\nEuF+PbWfLc9nuIVt6M1G1HGrgGRN0ETRNcQ+MkmXJjStIOZB/3NYJK0mjw1b\npxgXXyNxYkCLfM5pmqsNapCWMiOkFG7XwwrmW/btXyHi0/qjVhnCfF1YZccF\npDlmMkGLRn6M5NlbY9CSoJSjPFc9MbdyaWOAvN2wiqpDmqKY3bDJLB9saG7c\n9PfvSwbBcZmjGzjMOuBC7qHoRiQhuvmvtHqeqW9wkddyykb3xCjhLc61LFs7\nS7BmCGS2p+8f9Qt9p/S/MSG1sPjvtdT8RyEeVASNs583Ygwt/NKMa2JIvdEz\n2ZqsHBvk6pULx+jVmTxJTt6abOooIPJnBwX0BM85a1SBUoxbm5CtEyEIZfMH\nOjm8mQFvMJ0UPB0/840xiQwcFB1DPeUkaACgoXHo8pZ9gfIFnkzrXCtauY1Y\nqRp/KXoiSkw8yFUyFajTNG1kJFp56bRFAPA3wMZ882HlNINBCXlAAw67gdzX\nRyzgmWcEnMg1d0ap3317NaOXvKuwaLL/O66Js1zyIAqGRERZWY5mCwjhr7lO\ntPwn\r\n=WcTN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCc+tqXDxKWkEOMm0euBe1Iej3fpmzXA38ojYH9VhFT+gIhANE9dQAgRMbqKq4qAgp2TO/JsKTTPwPp6TQasuf7cdqj"}]},"_npmUser":{"name":"paco","email":"pvco.coursey@gmail.com"},"directories":{},"maintainers":[{"name":"paco","email":"pvco.coursey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-descendants_1.0.0-beta.2_1625893825467_0.8057711963318068"},"_hasShrinkwrap":false},"1.0.0-beta.3":{"name":"use-descendants","version":"1.0.0-beta.3","license":"MIT","main":"./dist/index.js","module":"./dist/index.modern.js","source":"./index.js","scripts":{"prepublish":"yarn build","build":"microbundle --compress --no-sourcemap"},"devDependencies":{"microbundle":"^0.13.3"},"peerDependencies":{"react":"*","react-dom":"*"},"readmeFilename":"README.md","readme":"# useDescendants ![npm bundle size](https://img.shields.io/bundlephobia/minzip/use-descendants)\n\nuseDescendants is a react hook for keeping track of descendant components and their relative indeces. It's based off the [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) package, but faster and smaller.\n\nIf you want to understand more about what this package does or why we need it, read the [Problem Complex](https://www.npmjs.com/package/@reach/descendants) from the @reach/descendants package.\n\nIn short, this package allows each item in a list to know it's relative index and the parent of the list can keep track of each child, without needing to render in a loop and pass each component an index.\n\nThis enables component composition:\n\n```js\n<List>\n  <Item /> {/* I'm index 0 */}\n  <Item /> {/* I'm index 1 */}\n  <div>\n    <div>\n      <Item /> {/* I'm arbitrarily nested, but still know that I'm index 2 */}\n    </div>\n  </div>\n</List>\n```\n\n## Installation\n\n```\n$ yarn add use-descendants\n```\n\n## Usage\n\nIn the parent, you call `useDescendants` and pass the result to `<Descendants>` that wraps the children. In each child item, retrieve that items index with the `useDescendant` hook.\n\n```jsx\nconst Menu = () => {\n  const context = useDescendants()\n  return (\n    <Descendants value={context}>\n      <Item />\n    </Descendants>\n  )\n}\n\nconst Item = () => {\n  const index = useDescendant()\n  return <div>My index is {index}</div>\n}\n```\n\nYou can pass any data you want to `useDescendant` and it will be available in the parent through the `map` ref:\n\n```jsx\n// In Item\nconst ref = useRef()\nconst index = useDescendant({ ref })\n\n// In Menu\nconst context = useDescendants()\nconsole.log(context.map.current)\n// => { '<randomItemId>': { index: 0, props: { ref: HTMLDivElement } } }\n```\n\nYou can also pass un-memoized values or callbacks here because it's just kept in a ref:\n\n```jsx\nconst index = useDescendant({\n  onSelect: () => {\n    /* Do something */\n  }\n})\n```\n\n## Credits\n\n- [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) and [Chance](https://twitter.com/chancethedev), who introduced me to this concept\n- @shuding for help with a faster, simpler implementation\n","description":"useDescendants is a react hook for keeping track of descendant components and their relative indeces. It's based off the [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) package, but faster and smaller.","_id":"use-descendants@1.0.0-beta.3","dist":{"shasum":"2310f6fb7492cc278fec98e690d67adc6bfff9fc","integrity":"sha512-Td6aU0LfxhQM5ZKscrmZd0LUPd410K+fCvJLXO7cjCEkymFuiMBrmD+N0ZI0vga8vZvAMaQiP7F0qcxogzBoKQ==","tarball":"https://registry.npmjs.org/use-descendants/-/use-descendants-1.0.0-beta.3.tgz","fileCount":7,"unpackedSize":5239,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg6S/wCRA9TVsSAnZWagAA1qUQAKPKHv05B5m7QHX1QZWe\nf7hARxcJhEMOO5u5obWtKmCEsLB4tBxHh064dO772KFc+hb5KhwZ+uIuBA/V\nd1WOSV64mCkH4KVvL5tnNXJgpMrcoiF9/w+is8bbRlGZ7+mWhMvDbXVU1blD\n9TXI0vjiua0g9LcB2NR/8O6NwAQsaJUeLtduwmRF4cP1+pyoow/Y4SJdG4Vi\nlGRCoeqYS6vUzXXMENZbTuRmu1RRvo2zRRy5YUF6V83EGGVMs0OO7a71YOt+\nbrocy0D8vACqomjmbMRB3tkIqvOQ+UmDY2CtvHzbjpb3L4nUpHD0BC8v/llR\nwviLZUVhsMvnVepzk2KHQj7ka8RYWM8S0Ci8OyOj2HFnrQubtNV8aI2FiNJy\nUHhZF10Le8ioJIXZHk0a7IUCvoUBJZiSEkITYrS63eIooZR9R/t2Tr+oeD1N\nBx8v+iiNQyTER3zjOd/ExxQ6Qo9vunmK+btk7DeuFHGfPjz0a/87002n/Cp9\nDTR85AyiDLseTrROO1+wD/KOeuuDQVQMBla2fJU+jFjRI/8a/GOVDB50/SMG\noeK+QJjUP+ixL72rFweWg8Gna1sMDlPglQqZr5aBLFM1CVUw8sMowLrd7FjV\nClruQK2SEbw1r/zzjx8tDKNhygEbWvEk6yyz3T/DpSck43tLorJIzaApwWtJ\nbdea\r\n=4SUK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG+lBAvEvZvMIV1cCWV7wFVRajgs49DlBgGlvIj88Oc4AiAp9P9aytJlvUuj9U2t++GDlLDiTGxyJMMCJbtiIwGw+Q=="}]},"_npmUser":{"name":"paco","email":"pvco.coursey@gmail.com"},"directories":{},"maintainers":[{"name":"paco","email":"pvco.coursey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-descendants_1.0.0-beta.3_1625894896486_0.7656891309878446"},"_hasShrinkwrap":false},"1.0.0-beta.4":{"name":"use-descendants","version":"1.0.0-beta.4","license":"MIT","main":"./dist/index.js","module":"./dist/index.modern.js","source":"./index.js","scripts":{"prepublish":"yarn build","build":"microbundle --compress --no-sourcemap --jsx React.createElement"},"devDependencies":{"microbundle":"^0.13.3"},"peerDependencies":{"react":"*","react-dom":"*"},"readmeFilename":"README.md","readme":"# useDescendants ![npm bundle size](https://img.shields.io/bundlephobia/minzip/use-descendants)\n\nuseDescendants is a react hook for keeping track of descendant components and their relative indeces. It's based off the [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) package, but faster and smaller.\n\nIf you want to understand more about what this package does or why we need it, read the [Problem Complex](https://www.npmjs.com/package/@reach/descendants) from the @reach/descendants package.\n\nIn short, this package allows each item in a list to know it's relative index and the parent of the list can keep track of each child, without needing to render in a loop and pass each component an index.\n\nThis enables component composition:\n\n```js\n<List>\n  <Item /> {/* I'm index 0 */}\n  <Item /> {/* I'm index 1 */}\n  <div>\n    <div>\n      <Item /> {/* I'm arbitrarily nested, but still know that I'm index 2 */}\n    </div>\n  </div>\n</List>\n```\n\n## Installation\n\n```\n$ yarn add use-descendants\n```\n\n## Usage\n\nIn the parent, you call `useDescendants` and pass the result to `<Descendants>` that wraps the children. In each child item, retrieve that items index with the `useDescendant` hook.\n\n```jsx\nconst Menu = () => {\n  const context = useDescendants()\n  return (\n    <Descendants value={context}>\n      <Item />\n    </Descendants>\n  )\n}\n\nconst Item = () => {\n  const index = useDescendant()\n  return <div>My index is {index}</div>\n}\n```\n\nYou can pass any data you want to `useDescendant` and it will be available in the parent through the `map` ref:\n\n```jsx\n// In Item\nconst ref = useRef()\nconst index = useDescendant({ ref })\n\n// In Menu\nconst context = useDescendants()\nconsole.log(context.map.current)\n// => { '<randomItemId>': { index: 0, props: { ref: HTMLDivElement } } }\n```\n\nYou can also pass un-memoized values or callbacks here because it's just kept in a ref:\n\n```jsx\nconst index = useDescendant({\n  onSelect: () => {\n    /* Do something */\n  }\n})\n```\n\n## Credits\n\n- [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) and [Chance](https://twitter.com/chancethedev), who introduced me to this concept\n- @shuding for help with a faster, simpler implementation\n","description":"useDescendants is a react hook for keeping track of descendant components and their relative indeces. It's based off the [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) package, but faster and smaller.","_id":"use-descendants@1.0.0-beta.4","dist":{"shasum":"e5d822d06294b857d1fdbc7624ce589cc35e8d85","integrity":"sha512-dfrg772uxDE6lQ2WgaGebcC7t5px4PO4Vu6eo4omkNSPBEJfGzumDyhbNjYjY5TFQvWzaV+KcB3ozETfz3Tf1A==","tarball":"https://registry.npmjs.org/use-descendants/-/use-descendants-1.0.0-beta.4.tgz","fileCount":7,"unpackedSize":5307,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg6TC3CRA9TVsSAnZWagAA1McP/ifAv9prpSo5/VVXJSDD\nr4j93A6GjFYbOYnqYNHCVbQ0aMYGXTdKodN03lSBgUjXtKPI9AjU0hN5dobF\n/fNgbaTeDPKpOtbMfmEEnN7zIHZVRtpAKKyVCtwWlWBcwiP6VPaC+mmSTpU0\nvnZe5mb+WOwPMJsnxtM1YNbbQ99ftauigNxcrXBAOjCtSD7gXNfMkztZnLQg\nXUBjBgmwsFYfkOYNPGowhTTDOT5AQOiMcWbjhHQxSymEHTjR3UosQiQriark\ngY+JoLjmdVk0Q6onp45SB01NPU1hmI6w+bSZT3kjwszPK7Bi6deBg0vizLYi\n1JFNy9h2kx3HieNem9xdBm2P8DWW6vyc2dyvDQXCslcCMmOuCER8UNtkNVhk\n1pVXROub3PCpRoL8DzBNedvm+PrTph11RCnTACbI5wwU5kDShd8BOwbI16j2\nY+Jfc/7pvWVx5N4kI6PA2QHx4xhmiYd6phEpkDtlImQyJGng5utwrhCe15c9\nq/8sXL6nPdcp/vsN/NKGjWpV8++P5jVZL4PGIi0oXzesskfe07b1lFdRIbvM\ns/Cw4G7J9ddTqMel4FWXVTng4f1VOfCrvhfK38pxB4Dlnhc/2UQF7tJnXAkN\nnl0gMEhj21pPl43wqsKgsAoFsEHVUWEV0B+FczIS9WMlx1hgg6FpyHl/vSiy\nuiIF\r\n=DwYy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDbhKvD11OI0pFKYIXeLqZ85xsG8PIkuJHPfNLI5uvZbAIgVe4YoVzZUMpo1hX6D8xauwa1o47/CwLHgrYbzOEc5CI="}]},"_npmUser":{"name":"paco","email":"pvco.coursey@gmail.com"},"directories":{},"maintainers":[{"name":"paco","email":"pvco.coursey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-descendants_1.0.0-beta.4_1625895095523_0.5214110642872867"},"_hasShrinkwrap":false},"1.0.0-beta.5":{"name":"use-descendants","version":"1.0.0-beta.5","license":"MIT","main":"./dist/index.js","module":"./dist/index.modern.js","source":"./index.js","scripts":{"prepublish":"yarn build","build":"microbundle --compress --no-sourcemap --jsx React.createElement"},"devDependencies":{"microbundle":"^0.13.3"},"peerDependencies":{"react":"*","react-dom":"*"},"readmeFilename":"README.md","readme":"# useDescendants ![npm bundle size](https://img.shields.io/bundlephobia/minzip/use-descendants)\n\n> This is the README for beta releases. The \"stable\" (but still v0) release is here: https://github.com/pacocoursey/use-descendants/tree/v0\n\nuseDescendants is a react hook for keeping track of descendant components and their relative indeces. It's based off the [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) package, but faster and smaller.\n\nIf you want to understand more about what this package does or why we need it, read the [Problem Complex](https://www.npmjs.com/package/@reach/descendants) from the @reach/descendants package.\n\nIn short, this package allows each item in a list to know it's relative index and the parent of the list can keep track of each child, without needing to render in a loop and pass each component an index.\n\nThis enables component composition:\n\n```js\n<List>\n  <Item /> {/* I'm index 0 */}\n  <Item /> {/* I'm index 1 */}\n  <div>\n    <div>\n      <Item /> {/* I'm arbitrarily nested, but still know that I'm index 2 */}\n    </div>\n  </div>\n</List>\n```\n\n## Installation\n\n```\n$ yarn add use-descendants@beta\n```\n\n## Usage\n\nIn the parent, you call `useDescendants` and pass the result to `<Descendants>` that wraps the children. In each child item, retrieve that items index with the `useDescendant` hook.\n\n```jsx\nconst Menu = () => {\n  const context = useDescendants()\n  return (\n    <Descendants value={context}>\n      <Item />\n    </Descendants>\n  )\n}\n\nconst Item = () => {\n  const index = useDescendant()\n  return <div>My index is {index}</div>\n}\n```\n\nYou can pass any data you want to `useDescendant` and it will be available in the parent through the `map` ref:\n\n```jsx\n// In Item\nconst ref = useRef()\nconst index = useDescendant({ ref })\n\n// In Menu\nconst context = useDescendants()\nconsole.log(context.map.current)\n// => { '<randomItemId>': { index: 0, props: { ref: HTMLDivElement } } }\n```\n\nYou can also pass un-memoized values or callbacks here because it's just kept in a ref:\n\n```jsx\nconst index = useDescendant({\n  onSelect: () => {\n    /* Do something */\n  }\n})\n```\n\n## Credits\n\n- [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) and [Chance](https://twitter.com/chancethedev), who introduced me to this concept\n- @shuding for help with a faster, simpler implementation\n","description":"> This is the README for beta releases. The \"stable\" (but still v0) release is here: https://github.com/pacocoursey/use-descendants/tree/v0","_id":"use-descendants@1.0.0-beta.5","dist":{"shasum":"e7db1a78b00aba929d2105211060cb8bb57bf3d0","integrity":"sha512-Byj+o8uFNQyBaOMSm/TQM0hMaJXMI9hlJDgL/CL1zwUTYxBIx0ajS8lFBwWbPMENnSkucF69pBJbYLfXzpyLGg==","tarball":"https://registry.npmjs.org/use-descendants/-/use-descendants-1.0.0-beta.5.tgz","fileCount":7,"unpackedSize":5348,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg7NAZCRA9TVsSAnZWagAAFvoP/RNP7KsooFOm77dxCQqF\nhLdLcAoEVjnFEahAzEOJx4MHGI9phNPm8F7F02ZL3sRU2WDch84pT8BtC1bi\ne0sRDx8L0hPdmmlUTVtvevO46jqfoqlo1EW/Gby3C62c0S5XFrPmnkXLv23A\nNVCddVoo4BX8YdZ8y72z1++CUV2/BDWOB4ASGIf6qP2yRu2Qz1iTdiGdepXf\nekBYtOcPjDOfoiYLA52Ka5HGFVNaIrxg7Xnpsb+rZMAje6lm4PEBxoDPKbp5\ni5/9Jxghty5YaWZzTS3ECHn1aaCUI3nM33rtyh51yJiSX0ml6I5xgb5TOYWP\nkPBkE8plWfQQ3hi7oHlTjLItduFK/uzFrImXgkgYAxoOKINS+j5sN+ynOfPd\nvv2mUEHJl5sycgkh1B0hTKCTQOqweXqJvN7T4KcdHpXWuxR0DOrN80cBNf6P\n/sN9UB+q7UjYO8KJsHLWeqgwsbQsnCtyJkspHsYDmMusj/oPt71y2w2Sxctf\nJrdV0fqiHc1BY1WBazuW6Bb0GlS1sH7XUwRODXKNj4dnzePKUYD7Pf5faLrZ\nkjIEKLM0Xrl44Zd7I+aSVytwjFy5EAbB4Mu5e94JJJMNT4BnVt+vjGH1AdTB\n/OlcPS6YnV3vtJk6CuN5Oy9s2t1kBLa+rW5Ce5wcrEypIUF7T8DoGlD/mUGi\nvqo2\r\n=BRH9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCSvnxP13MPHyd6G6Gof4YKDP+IxyFcXFYX2isM4MVvuQIgWKNrlu191rMF++5uxKwy41P2EoPKyxXj91q+mfqOC1Q="}]},"_npmUser":{"name":"paco","email":"pvco.coursey@gmail.com"},"directories":{},"maintainers":[{"name":"paco","email":"pvco.coursey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-descendants_1.0.0-beta.5_1626132504930_0.9411503086285742"},"_hasShrinkwrap":false},"1.0.0-beta.6":{"name":"use-descendants","version":"1.0.0-beta.6","license":"MIT","main":"./dist/index.js","module":"./dist/index.modern.js","source":"./index.js","scripts":{"prepublish":"yarn build","build":"microbundle --compress --no-sourcemap --jsx React.createElement"},"devDependencies":{"microbundle":"^0.13.3"},"peerDependencies":{"react":"*","react-dom":"*"},"readmeFilename":"README.md","readme":"# useDescendants ![npm bundle size](https://img.shields.io/bundlephobia/minzip/use-descendants@beta)\n\n> This is the README for beta releases. The \"stable\" (but still v0) release is here: https://github.com/pacocoursey/use-descendants/tree/v0\n\nuseDescendants is a react hook for keeping track of descendant components and their relative indeces. It's based off the [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) package, but faster and smaller.\n\nIf you want to understand more about what this package does or why we need it, read the [Problem Complex](https://www.npmjs.com/package/@reach/descendants) from the @reach/descendants package.\n\nIn short, this package allows each item in a list to know it's relative index and the parent of the list can keep track of each child, without needing to render in a loop and pass each component an index.\n\nThis enables component composition:\n\n```js\n<List>\n  <Item /> {/* I'm index 0 */}\n  <Item /> {/* I'm index 1 */}\n  <div>\n    <div>\n      <Item /> {/* I'm arbitrarily nested, but still know that I'm index 2 */}\n    </div>\n  </div>\n</List>\n```\n\n## Installation\n\n```\n$ yarn add use-descendants@beta\n```\n\n## Usage\n\nIn the parent, you call `useDescendants` and pass the result to `<Descendants>` that wraps the children. In each child item, retrieve that items index with the `useDescendant` hook.\n\n```jsx\nconst Menu = () => {\n  const context = useDescendants()\n  return (\n    <Descendants value={context}>\n      <Item />\n    </Descendants>\n  )\n}\n\nconst Item = () => {\n  const index = useDescendant()\n  return <div>My index is {index}</div>\n}\n```\n\n#### React.memo\n\nItems that use `React.memo` or stable keys will still have an up-to-date index, as they will be forcefully re-rendered whenever the parent re-renders. This means you can safely remove `React.memo`, as it will always be bypassed.\n\n#### Data passing\n\nYou can pass any data you want to `useDescendant` and it will be available in the parent through `map`:\n\n```jsx\n// In Item\nconst ref = useRef()\nconst index = useDescendant({ ref })\n\n// In Menu\nconst context = useDescendants()\nconsole.log(context.map.current)\n// => { '<randomItemId>': { index: 0, props: { ref: HTMLDivElement } } }\n```\n\nYou can also pass un-memoized values or callbacks that are always up-to-date here because it's just kept in a ref:\n\n```jsx\nconst index = useDescendant({\n  onSelect: () => {\n    /* Do something */\n  }\n})\n```\n\n## Credits\n\n- [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) and [Chance](https://twitter.com/chancethedev), who introduced me to this concept\n- [Shu Ding](https://twitter.com/shuding_) for help with a faster, simpler implementation\n","description":"> This is the README for beta releases. The \"stable\" (but still v0) release is here: https://github.com/pacocoursey/use-descendants/tree/v0","_id":"use-descendants@1.0.0-beta.6","dist":{"shasum":"69274b78128cb079664fe2276057c2ddcb1b9e4b","integrity":"sha512-0ia8+1dIXls8fvVT+oj2rdwVJJzk+xfAnQFKkwOttMH895Ji6hv1q5YjHlUBotjwnQXy5chpU7g5TKWWxjKMNw==","tarball":"https://registry.npmjs.org/use-descendants/-/use-descendants-1.0.0-beta.6.tgz","fileCount":7,"unpackedSize":6015,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg711NCRA9TVsSAnZWagAAbAAQAIK9V/3zYM56yO0Y5kIj\nNlqHU6qwlrFI4vuMAZ5J98CzyGLRVIzTI87trybGAuSP6u3UfKFXBrjw7CCK\njftXBxvCr3ApCZAj9h/HUzmwqiLSeNUqz2F7ZPFVOiKW0azMK3zvPYh5DJGs\nChMIIbhpmDKtEcjwQI1IYmaYS/qP9GoiDc0FudMVE1L8hV/QoeHO1IVoZ0xi\nSumX1S30ndsXUDGB7XZIVu9sJpsLkECEPDu9+2BjVgk/mhZ/klhRMk2wqdk/\niciPrzAib/Qw79cX0O9kJ86Kmhv9T71uekRnX7KuZCsZ4UaqZIAnin4jaSW5\n17gwHwxsL6qNR1TuKjtBUEIVCma3zwHBSE7fhtLgftuTzib7F9SWGx57Lco2\nliGcYgGpMbW3BQW2GI+jMaHllnOyresVpyvl754LK9iKvSdZiU7huh+WaPZL\n91gIYxeu6/0juTtU03oAPbX+wDmFYLAbcefL3PXPGoYZTydNDHsLgB3zEnpB\ngIwhmyN2vnWZ1EPg8wpiM4AcFNUMPt6dQzJ7EFJj7WMV3wHNUZ9q1LpzPADo\ngbvbS9v1PhBqppn63+j1gi8igSuPJgjKAUAyuzW/7XCjnNxxrzG7jAsVz7vH\n5VITSnPu5QDBnf29Nx5/mJAgUHiJRJuDUbHpWPX+woJLOBZYebSyxU7WgSV5\naSNc\r\n=r4p1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHYdtJy7/7NALRzXYZvPewKYe8q2Inp1wcOpNjGSM1DZAiEAnYOQfOpPUe9PwdvbNCHDWhe0KmicN5R0A1NaauBaNCo="}]},"_npmUser":{"name":"paco","email":"pvco.coursey@gmail.com"},"directories":{},"maintainers":[{"name":"paco","email":"pvco.coursey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-descendants_1.0.0-beta.6_1626299725429_0.32302713666450167"},"_hasShrinkwrap":false},"1.0.0-beta.7":{"name":"use-descendants","version":"1.0.0-beta.7","license":"MIT","main":"./dist/index.js","module":"./dist/index.modern.js","types":"./dist/index.d.ts","source":"./index.tsx","scripts":{"prepublish":"yarn build","build":"microbundle --compress --no-sourcemap --jsx React.createElement"},"devDependencies":{"@types/react":"^17.0.17","microbundle":"^0.13.3","typescript":"^4.3.5"},"peerDependencies":{"react":"*","react-dom":"*"},"readmeFilename":"README.md","readme":"# useDescendants ![npm bundle size](https://img.shields.io/bundlephobia/minzip/use-descendants@beta)\n\n> This is the README for beta releases. The \"stable\" (but still v0) release is here: https://github.com/pacocoursey/use-descendants/tree/v0\n\nuseDescendants is a react hook for keeping track of descendant components and their relative indeces. It's based off the [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) package, but faster and smaller.\n\nIf you want to understand more about what this package does or why we need it, read the [Problem Complex](https://www.npmjs.com/package/@reach/descendants) from the @reach/descendants package.\n\nIn short, this package allows each item in a list to know it's relative index and the parent of the list can keep track of each child, without needing to render in a loop and pass each component an index.\n\nThis enables component composition:\n\n```js\n<List>\n  <Item /> {/* I'm index 0 */}\n  <Item /> {/* I'm index 1 */}\n  <div>\n    <div>\n      <Item /> {/* I'm arbitrarily nested, but still know that I'm index 2 */}\n    </div>\n  </div>\n</List>\n```\n\n## Installation\n\n```\n$ yarn add use-descendants@beta\n```\n\n## Usage\n\nIn the parent, you call `useDescendants` and pass the result to `<Descendants>` that wraps the children. In each child item, retrieve that items index with the `useDescendant` hook.\n\n```jsx\nconst Menu = () => {\n  const context = useDescendants()\n  return (\n    <Descendants value={context}>\n      <Item />\n    </Descendants>\n  )\n}\n\nconst Item = () => {\n  const index = useDescendant()\n  return <div>My index is {index}</div>\n}\n```\n\n#### React.memo\n\nItems that use `React.memo` or stable keys will still have an up-to-date index, as they will be forcefully re-rendered whenever the parent re-renders. This means you can safely remove `React.memo`, as it will always be bypassed.\n\n#### Data passing\n\nYou can pass any data you want to `useDescendant` and it will be available in the parent through `map`:\n\n```jsx\n// In Item\nconst ref = useRef()\nconst index = useDescendant({ ref })\n\n// In Menu\nconst context = useDescendants()\nconsole.log(context.map.current)\n// => { '<randomItemId>': { index: 0, props: { ref: HTMLDivElement } } }\n```\n\nYou can also pass un-memoized values or callbacks that are always up-to-date here because it's just kept in a ref:\n\n```jsx\nconst index = useDescendant({\n  onSelect: () => {\n    /* Do something */\n  }\n})\n```\n\n## Credits\n\n- [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) and [Chance](https://twitter.com/chancethedev), who introduced me to this concept\n- [Shu Ding](https://twitter.com/shuding_) for help with a faster, simpler implementation\n","description":"> This is the README for beta releases. The \"stable\" (but still v0) release is here: https://github.com/pacocoursey/use-descendants/tree/v0","_id":"use-descendants@1.0.0-beta.7","dist":{"shasum":"a79f424c98bb5e11d0ca04bff5d86341fd752d40","integrity":"sha512-R1vODZbZsKnUOfODKYKxNW/5keD1FU3jvEi77dyauNnB2qm6QfqK2K4MISFUqvVYLb03eRg9V3Rqr281aaNFOw==","tarball":"https://registry.npmjs.org/use-descendants/-/use-descendants-1.0.0-beta.7.tgz","fileCount":8,"unpackedSize":6997,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhE/VjCRA9TVsSAnZWagAAnIsQAJNikE+BzsL7e4gD2Cj7\niEi3CXzi6ikHRdJGhZDqnmVXNzQJ9UhEpINihHutOqRxbLAbYKkyLVQyot4t\n7Os7MKSbBfrzJhzezfS1rSU4dhRtdFvuBmkJJHm/+OPpch196VxsS1ZmmH+W\nHnfR4JPz1kJ6ieAF6YT3hrwGZHJXKbB3IHI9tpUujsgSXC46wpEgy8b2Zlid\nbP9lGhGvAYF7QuvosuBp3d7YOc/5372/PYHTtEhxNKq0GVXErNOqXy7pJVma\nrXdP0hKyFHYQZcAYhgFeJEOONZ+3xexMhtfOouXqReWqBckbLLSBGVyHKJwE\nFnKRcpI2RM1Li/b9n8lOXW2Q7OYOQ4CcM1hnzCEYnggwSpkHcxjINQV+A9Qz\n5HRkiE6FS2d+WxUT3NOOBfGMGlji9diTLUSmcqYTbH320Win4jVlFguLcjow\npR10sIfUW2DMjvFZCoJQJrUC0r1d5/JFOrd3M588wSc0N6xLMNa3GHLO6KGe\nKQ88gTZn9Zh7qJIjEcgofhcVEh4ZU4ksvlu/w9jbD90M00Q3ht7vpELiUn1s\n5hHTsZOP8yyGmNIo/FFMrjowbbY1uKOfsNs0UwDEE288QLjMSlSRXe6ysDb9\nxZMeQy2LD5rmKrqNPAlpDJ0R4A4BW7/x0Haso9Z4ypNDMjVkcw9hEEYRv/Ow\nXo+a\r\n=DYbK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDfRAWV3zAvaTuZQkYL3WO3mh3F8C5WKJU6jqhvKHckzwIgLquSjGhtQDEcnXHbFaevqW3jrv16c0WdgljK+EVOf6A="}]},"_npmUser":{"name":"paco","email":"pvco.coursey@gmail.com"},"directories":{},"maintainers":[{"name":"paco","email":"pvco.coursey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-descendants_1.0.0-beta.7_1628697954943_0.5083551052857591"},"_hasShrinkwrap":false},"1.0.0-beta.8":{"name":"use-descendants","version":"1.0.0-beta.8","license":"MIT","main":"./dist/index.js","module":"./dist/index.modern.js","source":"./index.js","scripts":{"prepublish":"yarn build","build":"microbundle --compress --no-sourcemap --jsx React.createElement"},"devDependencies":{"microbundle":"^0.13.3"},"peerDependencies":{"react":"*","react-dom":"*"},"readmeFilename":"README.md","readme":"# useDescendants ![npm bundle size](https://img.shields.io/bundlephobia/minzip/use-descendants@beta)\n\n> This is the README for beta releases. The \"stable\" (but still v0) release is here: https://github.com/pacocoursey/use-descendants/tree/v0\n\nuseDescendants is a react hook for keeping track of descendant components and their relative indeces. It's based off the [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) package, but faster and smaller.\n\nIf you want to understand more about what this package does or why we need it, read the [Problem Complex](https://www.npmjs.com/package/@reach/descendants) from the @reach/descendants package.\n\nIn short, this package allows each item in a list to know it's relative index and the parent of the list can keep track of each child, without needing to render in a loop and pass each component an index.\n\nThis enables component composition:\n\n```js\n<List>\n  <Item /> {/* I'm index 0 */}\n  <Item /> {/* I'm index 1 */}\n  <div>\n    <div>\n      <Item /> {/* I'm arbitrarily nested, but still know that I'm index 2 */}\n    </div>\n  </div>\n</List>\n```\n\n## Installation\n\n```\n$ yarn add use-descendants@beta\n```\n\n## Usage\n\nIn the parent, you call `useDescendants` and pass the result to `<Descendants>` that wraps the children. In each child item, retrieve that items index with the `useDescendant` hook.\n\n```jsx\nconst Menu = () => {\n  const context = useDescendants()\n  return (\n    <Descendants value={context}>\n      <Item />\n    </Descendants>\n  )\n}\n\nconst Item = () => {\n  const index = useDescendant()\n  return <div>My index is {index}</div>\n}\n```\n\n#### React.memo\n\nItems that use `React.memo` or stable keys will still have an up-to-date index, as they will be forcefully re-rendered whenever the parent re-renders. This means you can safely remove `React.memo`, as it will always be bypassed.\n\n#### Data passing\n\nYou can pass any data you want to `useDescendant` and it will be available in the parent through `map`:\n\n```jsx\n// In Item\nconst ref = useRef()\nconst index = useDescendant({ ref })\n\n// In Menu\nconst context = useDescendants()\nconsole.log(context.map.current)\n// => { '<randomItemId>': { index: 0, props: { ref: HTMLDivElement } } }\n```\n\nYou can also pass un-memoized values or callbacks that are always up-to-date here because it's just kept in a ref:\n\n```jsx\nconst index = useDescendant({\n  onSelect: () => {\n    /* Do something */\n  }\n})\n```\n\n## Credits\n\n- [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) and [Chance](https://twitter.com/chancethedev), who introduced me to this concept\n- [Shu Ding](https://twitter.com/shuding_) for help with a faster, simpler implementation\n","description":"> This is the README for beta releases. The \"stable\" (but still v0) release is here: https://github.com/pacocoursey/use-descendants/tree/v0","_id":"use-descendants@1.0.0-beta.8","dist":{"shasum":"6476bb61e209508762bc8f26fc2a7f885a3f845a","integrity":"sha512-r7gs5+6MVzFhJ1ZN9/npA+CydV4uffWPqZZ5wC4DPJfrGvBkd0KK+qQ6ulDTumQXuD+7uDz6JXAdgayKMDm4Zw==","tarball":"https://registry.npmjs.org/use-descendants/-/use-descendants-1.0.0-beta.8.tgz","fileCount":7,"unpackedSize":6060,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhQQHNCRA9TVsSAnZWagAA7ncQAJArG5Ofx/2RRWbDVKrz\ndbAkosDIX9i4ggEJuEMnOSxDyalOwOZVYEJUDaZf3LqMDUoOs/QzrJ7ZaClj\nFiMqFfNhu86F6rZEWWFv2unlEkaklOx5gdh9upTAL5kWI+UxzgMjHs3lO+St\nXCjqgJISOFsVf/pF/qPSz4f6NLCrOZoT1SPhbgMjER8ebSyn308XxLprFUQ5\ns1VQB2v6fwu024jhBcOQmFCFTIocEDo9ze5z0Ata41UzSmrCnkzDWe7cvyOB\nlZ7e90x3QH/Vsh8rGkwHGZTBr2bOfm9eLql0DLHWcbiVaFPo1OntCY5ILF4+\n3iPzb/8hunId66DZ/oW7eGndRic6l+OJf7KRBMcOSLqAx+02BIZEmG3lHXJl\nlEOBCeAyf391UmjCr3ELQAnLtd4EDJARZQj0FXA+/VbbUX0Q0Vv8LGIy4pEY\nmB4XZ1MbcZbVqh2CT0vnULmI3pKZcsKFOWrPbiLn00mM+Eo/fIRBzyhjsfHf\nRAPccaKJzvDXiy2vBycJwf3isMP4vqgjiHToMLreyDdICXWzeYK+NuMPEsz5\n/gix4URpC/z2vjC6q+9jZmsgtq/3u9WXhKKfGsLGXBa4CADZRIiAbafCVcUz\nafuSArxLhyAQk9qYRHEGj+HEHVqRG8+Ns4z8tHPLVkoDVVq3kikREUdfwE/n\npNZf\r\n=32iE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQChj6S24F9y4wia1cel2z2QNpVJ+g55bA021ZY3KK0BlQIhAJOg3myUhHv7+dkqCjZvHEIWgGeshfI3uaQxihmMKn/e"}]},"_npmUser":{"name":"paco","email":"pvco.coursey@gmail.com"},"directories":{},"maintainers":[{"name":"paco","email":"pvco.coursey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-descendants_1.0.0-beta.8_1631650253482_0.8825790386997252"},"_hasShrinkwrap":false},"1.0.0-beta.9":{"name":"use-descendants","version":"1.0.0-beta.9","license":"MIT","main":"./dist/index.js","module":"./dist/index.modern.js","source":"./index.js","scripts":{"prepublish":"yarn build","build":"microbundle --compress --no-sourcemap --jsx React.createElement"},"devDependencies":{"microbundle":"^0.13.3"},"peerDependencies":{"react":"*","react-dom":"*"},"readmeFilename":"README.md","readme":"# useDescendants ![npm bundle size](https://img.shields.io/bundlephobia/minzip/use-descendants@beta)\n\n> This is the README for beta releases. The \"stable\" (but still v0) release is here: https://github.com/pacocoursey/use-descendants/tree/v0\n\nuseDescendants is a react hook for keeping track of descendant components and their relative indeces. It's based off the [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) package, but faster and smaller.\n\nIf you want to understand more about what this package does or why we need it, read the [Problem Complex](https://www.npmjs.com/package/@reach/descendants) from the @reach/descendants package.\n\nIn short, this package allows each item in a list to know it's relative index and the parent of the list can keep track of each child, without needing to render in a loop and pass each component an index.\n\nThis enables component composition:\n\n```js\n<List>\n  <Item /> {/* I'm index 0 */}\n  <Item /> {/* I'm index 1 */}\n  <div>\n    <div>\n      <Item /> {/* I'm arbitrarily nested, but still know that I'm index 2 */}\n    </div>\n  </div>\n</List>\n```\n\n## Installation\n\n```\n$ yarn add use-descendants@beta\n```\n\n## Usage\n\nIn the parent, you call `useDescendants` and pass the result to `<Descendants>` that wraps the children. In each child item, retrieve that items index with the `useDescendant` hook.\n\n```jsx\nconst Menu = () => {\n  const context = useDescendants()\n  return (\n    <Descendants value={context}>\n      <Item />\n    </Descendants>\n  )\n}\n\nconst Item = () => {\n  const index = useDescendant()\n  return <div>My index is {index}</div>\n}\n```\n\n#### React.memo\n\nItems that use `React.memo` or stable keys will still have an up-to-date index, as they will be forcefully re-rendered whenever the parent re-renders. This means you can safely remove `React.memo`, as it will always be bypassed.\n\n#### Data passing\n\nYou can pass any data you want to `useDescendant` and it will be available in the parent through `map`:\n\n```jsx\n// In Item\nconst ref = useRef()\nconst index = useDescendant({ ref })\n\n// In Menu\nconst context = useDescendants()\nconsole.log(context.map.current)\n// => { '<randomItemId>': { index: 0, props: { ref: HTMLDivElement } } }\n```\n\nYou can also pass un-memoized values or callbacks that are always up-to-date here because it's just kept in a ref:\n\n```jsx\nconst index = useDescendant({\n  onSelect: () => {\n    /* Do something */\n  }\n})\n```\n\n## Credits\n\n- [@reach/descendants](https://www.npmjs.com/package/@reach/descendants) and [Chance](https://twitter.com/chancethedev), who introduced me to this concept\n- [Shu Ding](https://twitter.com/shuding_) for help with a faster, simpler implementation\n","description":"> This is the README for beta releases. The \"stable\" (but still v0) release is here: https://github.com/pacocoursey/use-descendants/tree/v0","_id":"use-descendants@1.0.0-beta.9","dist":{"shasum":"cded96db46093e1ebd6696f9c519b63486ffb050","integrity":"sha512-CY+SQmJeV7TYY836HxWRzd6LQjZRjsXTPO89JyP4czP2iMxBR1TEMCSg5ytviZE6z0/6i1+CggLa3vN6/LNLww==","tarball":"https://registry.npmjs.org/use-descendants/-/use-descendants-1.0.0-beta.9.tgz","fileCount":7,"unpackedSize":6054,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCA7Rp07dKK9IMxzuL7v1Hrr8Zv67aDYPG0kGU3jFtsKQIhAOIOTFEIRqPPkQj6TPEqLOzyxp/b14aA4YkUPtMi/p2j"}]},"_npmUser":{"name":"paco","email":"pvco.coursey@gmail.com"},"directories":{},"maintainers":[{"name":"paco","email":"pvco.coursey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-descendants_1.0.0-beta.9_1632839726971_0.21229423665608493"},"_hasShrinkwrap":false}},"time":{"created":"2020-09-15T02:05:58.373Z","0.0.1":"2020-09-15T02:05:58.608Z","modified":"2022-05-22T22:02:17.901Z","0.0.2":"2021-05-11T20:23:30.931Z","0.0.2-beta.0":"2021-07-02T15:36:04.452Z","0.0.2-beta.1":"2021-07-02T15:36:24.770Z","0.0.3":"2021-07-02T22:17:55.370Z","0.0.4":"2021-07-02T22:24:35.771Z","1.0.0-beta.0":"2021-07-08T20:46:00.138Z","1.0.0-beta.1":"2021-07-10T04:55:31.873Z","1.0.0-beta.2":"2021-07-10T05:10:25.616Z","1.0.0-beta.3":"2021-07-10T05:28:16.627Z","1.0.0-beta.4":"2021-07-10T05:31:35.662Z","1.0.0-beta.5":"2021-07-12T23:28:25.055Z","1.0.0-beta.6":"2021-07-14T21:55:25.559Z","1.0.0-beta.7":"2021-08-11T16:05:55.054Z","1.0.0-beta.8":"2021-09-14T20:10:53.606Z","1.0.0-beta.9":"2021-09-28T14:35:27.182Z"},"maintainers":[{"name":"paco","email":"pvco.coursey@gmail.com"}],"description":"> Warning: useDescendants is experimental and primarily intended for personal use. It heavily relies on refs and the DOM and likely will not be concurrent mode compatible.","license":"MIT","readme":"","readmeFilename":""}