{"id":13452543,"url":"https://github.com/birkir/react-children-addons","last_synced_at":"2026-03-02T23:37:16.072Z","repository":{"id":137962974,"uuid":"155039933","full_name":"birkir/react-children-addons","owner":"birkir","description":"React Children Addons","archived":false,"fork":false,"pushed_at":"2019-05-03T10:00:17.000Z","size":35,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-13T05:48:07.115Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/birkir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-10-28T05:53:05.000Z","updated_at":"2021-01-13T02:41:03.000Z","dependencies_parsed_at":"2023-03-22T05:50:06.100Z","dependency_job_id":null,"html_url":"https://github.com/birkir/react-children-addons","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/birkir/react-children-addons","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/birkir%2Freact-children-addons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/birkir%2Freact-children-addons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/birkir%2Freact-children-addons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/birkir%2Freact-children-addons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/birkir","download_url":"https://codeload.github.com/birkir/react-children-addons/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/birkir%2Freact-children-addons/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259804841,"owners_count":22913901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T07:01:27.070Z","updated_at":"2026-03-02T23:37:11.046Z","avatar_url":"https://github.com/birkir.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"![](https://img.shields.io/npm/v/react-children-addons.svg?\u0026style=flat-square) ![](https://img.shields.io/bundlephobia/min/react-children-addons.svg?\u0026style=flat-square) ![](https://img.shields.io/npm/l/react-children-addons.svg?\u0026style=flat-square) ![](https://img.shields.io/david/birkir/react-children-addons.svg?\u0026style=flat-square)  ![](https://img.shields.io/npm/dw/react-children-addons.svg?\u0026style=flat-square)\n# react-children-addons\n\nReact children utilities and addons\n\n```bash\nnpm install react-children-addons -S\n\n# or\n\nyarn add react-children-addons -S\n```\n\n## API Methods\n - [toFlatArray](#toflatarray)\n - [mapFlat](#mapflat)\n\n### toFlatArray\n\nTakes children and flattens all React.Fragments into a single array\n\n```jsx\nimport { toFlatArray } from 'react-children-addons';\n\nfunction List({ children }) {\n  console.log(toFlatArray(children));\n}\n\n\u003cList\u003e\n  \u003cli\u003eItem\u003c/li\u003e\n  \u003c\u003e\n    \u003cli\u003eAnother Item\u003c/li\u003e\n  \u003c/\u003e\n\u003c/List\u003e\n```\n```jsx\n[\u003cli\u003eItem\u003c/li\u003e, \u003cli\u003eAnother Item\u003c/li\u003e]\n```\n\n### mapFlat\n\nSame as `toFlatArray` but with a map function\n\n```jsx\nimport React from 'react';\nimport { mapFlat } from 'react-children-addons';\n\nfunction List({ children }) {\n  return (\n    \u003cul\u003e\n      {mapFlat(children, child =\u003e React.cloneElement(child, { className: 'link' }))}\n    \u003c/ul\u003e\n  );\n}\n\n\u003cList\u003e\n  \u003cli\u003eItem\u003c/li\u003e\n  \u003c\u003e\n    \u003cli\u003eAnother Item\u003c/li\u003e\n  \u003c/\u003e\n  \u003cReact.Fragment\u003e\n    \u003c\u003e\n      \u003cli\u003eNested Item\u003c/li\u003e\n    \u003c/\u003e\n  \u003c/React.Fragment\u003e\n\u003c/List\u003e\n```\n```html\n\u003cul\u003e\n  \u003cli class=\"link\"\u003eItem\u003c/li\u003e\n  \u003cli class=\"link\"\u003eAnother Item\u003c/li\u003e\n  \u003cli class=\"link\"\u003eNested Item\u003c/li\u003e\n\u003c/ul\u003e\n```\n\n\n## Todo\n\nAdd tests, changelog and more ideas for addons.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbirkir%2Freact-children-addons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbirkir%2Freact-children-addons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbirkir%2Freact-children-addons/lists"}