{"id":28279255,"url":"https://github.com/delpikye-v/react-loop","last_synced_at":"2026-02-18T14:03:11.223Z","repository":{"id":258639346,"uuid":"875374050","full_name":"delpikye-v/react-loop","owner":"delpikye-v","description":"React wrapper loop. Simple and easy to use","archived":false,"fork":false,"pushed_at":"2025-09-18T17:02:06.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-10T07:40:22.755Z","etag":null,"topics":["loops","react-for-each","react-loop"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/react-loop-z","language":null,"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/delpikye-v.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-10-19T19:56:07.000Z","updated_at":"2025-09-18T17:02:54.000Z","dependencies_parsed_at":"2024-10-20T00:11:34.056Z","dependency_job_id":null,"html_url":"https://github.com/delpikye-v/react-loop","commit_stats":null,"previous_names":["delpikye-v/react-loop"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/delpikye-v/react-loop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delpikye-v%2Freact-loop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delpikye-v%2Freact-loop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delpikye-v%2Freact-loop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delpikye-v%2Freact-loop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/delpikye-v","download_url":"https://codeload.github.com/delpikye-v/react-loop/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delpikye-v%2Freact-loop/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29581536,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T13:56:48.962Z","status":"ssl_error","status_checked_at":"2026-02-18T13:54:34.145Z","response_time":162,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["loops","react-for-each","react-loop"],"created_at":"2025-05-21T09:14:16.971Z","updated_at":"2026-02-18T14:03:11.218Z","avatar_url":"https://github.com/delpikye-v.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# ✨ react-loop-z\n\n[![NPM](https://img.shields.io/npm/v/react-loop-z.svg)](https://www.npmjs.com/package/react-loop-z) ![Downloads](https://img.shields.io/npm/dt/react-loop-z.svg)\n\n\u003ca href=\"https://codesandbox.io/p/sandbox/dc9msq\" target=\"_blank\"\u003eLIVE EXAMPLE\u003c/a\u003e\n\n---\n\n**react-loop-z** is a lightweight, type-safe, declarative looping\ntoolkit for React.\n\nIt helps you replace `.map()` chains and manual iteration logic with\n**clean, expressive JSX blocks**.\n\n\u003e Write loops like logic. Render JSX like structure.\n\n---\n\n## 📖 Why react-loop-z?\n\n-   Declarative JSX loops\n-   Strict TypeScript support\n-   Zero dependencies\n-   Tree-shakable\n-   Infinite loop protection (safe guards)\n-   SSR \u0026 StrictMode safe\n-   Tiny bundle size\n\n---\n\n## 🧠 Mental Model\n\n- Pure function components\n- No internal state machines\n- No proxies or runtime magic\n- Strict generic typing\n- Guard-based loop safety\n\n\u003e Each loop is an independent, tree-shakable unit.\n\u003e Import only what you use.\n\n---\n\n## 📦 Installation\n\n``` bash\nnpm install react-loop-z\n```\n\n---\n\n## 🚀 Usage\n\n#### 🔁 For (Array iteration)\n\n``` tsx\nimport { For } from \"react-loop-z\";\n\n\u003cFor\n  of={[\"foo\", \"bar\"]}\n\u003e\n  {(item, index) =\u003e (\n    \u003cspan key={index}\u003eHello, {item}\u003c/span\u003e\n  )}\n\u003c/For\u003e\n```\n\nType-safe example:\n\n``` tsx\ntype User = { id: number; name: string };\n\n\u003cFor\u003cUser\u003e of={users}\u003e\n  {(user) =\u003e \u003cdiv key={user.id}\u003e{user.name}\u003c/div\u003e}\n\u003c/For\u003e\n```\n\n---\n\n#### 🔢 Range / Numeric Loop\n\n``` tsx\nimport { RangeLoop } from \"react-loop-z\";\n\n\u003cRangeLoop from={0} to={5}\u003e\n  {(i) =\u003e \u003cdiv key={i}\u003e{i}\u003c/div\u003e}\n\u003c/RangeLoop\u003e\n```\n\n---\n\n#### 🔂 While\n\n``` tsx\nimport { While } from \"react-loop-z\";\n\nlet i = 0;\n\n\u003cWhile\n  condition={() =\u003e i++ \u003c 3}\n\u003e\n  {(index) =\u003e \u003cdiv key={index}\u003eCount {index}\u003c/div\u003e}\n\u003c/While\u003e\n```\n\n---\n\n#### 🔄 Do\n\n``` tsx\nimport { Do } from \"react-loop-z\";\n\nlet i = 0;\n\n\u003cDo\n  condition={() =\u003e i \u003c 3}\n\u003e\n  {(index) =\u003e {\n    i++;\n    return \u003cdiv key={index}\u003eCount {index}\u003c/div\u003e;\n  }}\n\u003c/Do\u003e\n```\n\n---\n\n#### 🗺️ MapLoop\n\n``` tsx\nimport { MapLoop } from \"react-loop-z\";\n\n\u003cMapLoop of={new Map([[\"a\", 1], [\"b\", 2]])}\u003e\n  {(value, key) =\u003e (\n    \u003cdiv key={key}\u003e\n      {key}: {value}\n    \u003c/div\u003e\n  )}\n\u003c/MapLoop\u003e\n```\n\n---\n\n#### 🧩 SetLoop\n\n``` tsx\nimport { SetLoop } from \"react-loop-z\";\n\n\u003cSetLoop of={new Set([\"foo\", \"bar\"])}\u003e\n  {(item) =\u003e \u003cdiv key={item}\u003e{item}\u003c/div\u003e}\n\u003c/SetLoop\u003e\n```\n\n---\n\n#### 🗂️ ObjectLoop\n\n``` tsx\nimport { ObjectLoop } from \"react-loop-z\";\n\n\u003cObjectLoop of={{ a: 1, b: 2 }}\u003e\n  {(value, key) =\u003e (\n    \u003cdiv key={key}\u003e\n      {key}: {value}\n    \u003c/div\u003e\n  )}\n\u003c/ObjectLoop\u003e\n```\n\n---\n\n## 🛡 Infinite Loop Protection\n\n`While`, `Do`, and numeric loops include safety guards to prevent\nrunaway infinite loops in development.\n\nAlways ensure your condition eventually becomes false.\n\n---\n\n#### 🔥 BreakableLoop\n\nDeclarative loop with early exit support (like `break` in JavaScript).\n\n``` tsx\n\u003cBreakableLoop items={users}\u003e\n  {(user, { breakLoop }) =\u003e {\n    if (!user.active) breakLoop()\n    return \u003cUserCard user={user} /\u003e\n  }}\n\u003c/BreakableLoop\u003e\n```\n\n---\n\n#### 🔎 FilterLoop\n\nRender conditionally without chaining `.filter().map()`.\n\n``` tsx\n\u003cFilterLoop items={products} when={(p) =\u003e p.inStock}\u003e\n  {(product) =\u003e \u003cProductItem product={product} /\u003e}\n\u003c/FilterLoop\u003e\n```\n\n---\n\n#### 🧱 ChunkLoop\n\nSplit an array into chunks (ideal for grid or row rendering).\n\n``` tsx\n\u003cChunkLoop items={posts} size={3}\u003e\n  {(chunk) =\u003e (\n    \u003cdiv className=\"row\"\u003e\n      {chunk.map(post =\u003e \u003cPostCard key={post.id} {...post} /\u003e)}\n    \u003c/div\u003e\n  )}\n\u003c/ChunkLoop\u003e\n```\n\n---\n\n#### ✂️ TakeLoop\n\nRender only the first N elements (lightweight alternative to `slice`).\n\n``` tsx\n\u003cTakeLoop items={messages} count={5}\u003e\n  {(msg) =\u003e \u003cMessageItem message={msg} /\u003e}\n\u003c/TakeLoop\u003e\n```\n\n---\n\n#### 🧬 UniqueLoop\n\nRemove duplicates by key selector before rendering.\n\n``` tsx\n\u003cUniqueLoop items={users} by={(u) =\u003e u.email}\u003e\n  {(user) =\u003e \u003cUserRow user={user} /\u003e}\n\u003c/UniqueLoop\u003e\n```\n\n---\n\n#### 📦 FlatLoop\n\nFlatten nested arrays before rendering.\n\n``` tsx\n\u003cFlatLoop items={nestedComments}\u003e\n  {(comment) =\u003e \u003cCommentItem comment={comment} /\u003e}\n\u003c/FlatLoop\u003e\n```\n\n---\n\n#### ⏳ AsyncLoop\n\nSupports async iterables, promises, or async generators with built-in\nasync handling.\n\n``` tsx\n\u003cAsyncLoop items={fetchUsers()}\u003e\n  {(user) =\u003e \u003cUserCard user={user} /\u003e}\n\u003c/AsyncLoop\u003e\n```\n\nOr:\n\n``` tsx\n\u003cAsyncLoop items={asyncGenerator()}\u003e\n  {(value) =\u003e \u003cdiv\u003e{value}\u003c/div\u003e}\n\u003c/AsyncLoop\u003e\n```\n\n---\n\n## ⚡ Core Numeric Loops\n\n#### RangeLoop\n\nDeclarative numeric range loop.\n\n``` tsx\n\u003cRangeLoop from={1} to={5}\u003e\n  {(i) =\u003e \u003cdiv\u003e{i}\u003c/div\u003e}\n\u003c/RangeLoop\u003e\n```\n\n---\n\n#### TimesLoop\n\nRender N times (simple repeat utility).\n\n``` tsx\n\u003cTimesLoop times={3}\u003e\n  {(index) =\u003e \u003cSkeleton key={index} /\u003e}\n\u003c/TimesLoop\u003e\n```\n\n---\n\n## 📊 Comparison\n\n| Feature                     | react-loop-z | react-loops | react-for | Native `.map()` |\n|-----------------------------|--------------|-------------|-----------|-----------------|\n| Declarative JSX Blocks      | ✅            | ✅          | ✅        | ❌              |\n| Strong TypeScript Inference | ✅            | ⚠️ Partial  | ⚠️        | ⚠️ Manual       |\n| Array Loop                  | ✅            | ✅          | ✅        | ✅              |\n| Numeric / Range Loop        | ✅            | ❌          | ⚠️        | ❌              |\n| While / Do Loop             | ✅            | ⚠️          | ⚠️        | ❌              |\n| Map / Set / Object Support  | ✅            | ✅ Iterable | ⚠️        | ⚠️ Manual       |\n| Break Control               | ✅            | ❌          | ❌        | ❌              |\n| Async Loop                  | ✅            | ❌          | ❌        | ❌              |\n| Infinite Loop Protection    | ✅            | ❌          | ❌        | ❌              |\n| Zero Runtime Dependencies   | ✅            | ❌          | ⚠️        | ✅              |\n| Tree-Shakable               | ✅            | ❌          | ❌        | ✅              |\n\n\u003e A declarative loop control system for React — not just array mapping.\n\n---\n\n## 🎯 Philosophy\n\n-   Keep rendering pure\n-   Keep iteration declarative\n-   Keep bundle tiny\n-   Keep logic readable\n\n\u003e Iteration belongs to structure, not utility chains.\n\n---\n\n## 🏁 Final Thought\n\nreact-loop-z is not trying to replace `.map()`.\n\nIt provides:\n\n- Structure-driven iteration\n- Declarative control flow\n- Composable loop primitives\n\nThink of it as: **Control flow components for React.**\n\n---\n\n## 📄 License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelpikye-v%2Freact-loop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdelpikye-v%2Freact-loop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelpikye-v%2Freact-loop/lists"}