{"id":16747477,"url":"https://github.com/roydukkey/jsx-destruct","last_synced_at":"2025-06-30T16:35:41.957Z","repository":{"id":48056987,"uuid":"383611184","full_name":"roydukkey/jsx-destruct","owner":"roydukkey","description":"This tiny package allows you to unpack values directly in JSX statements","archived":false,"fork":false,"pushed_at":"2021-08-09T16:14:47.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T18:14:10.509Z","etag":null,"topics":["destructuring","jsx"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roydukkey.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["roydukkey"]}},"created_at":"2021-07-06T22:23:10.000Z","updated_at":"2021-08-09T16:14:18.000Z","dependencies_parsed_at":"2022-08-12T17:40:29.584Z","dependency_job_id":null,"html_url":"https://github.com/roydukkey/jsx-destruct","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roydukkey%2Fjsx-destruct","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roydukkey%2Fjsx-destruct/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roydukkey%2Fjsx-destruct/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roydukkey%2Fjsx-destruct/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roydukkey","download_url":"https://codeload.github.com/roydukkey/jsx-destruct/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814979,"owners_count":20352077,"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":["destructuring","jsx"],"created_at":"2024-10-13T02:10:05.668Z","updated_at":"2025-03-16T02:24:17.555Z","avatar_url":"https://github.com/roydukkey.png","language":"JavaScript","readme":"# jsx-destruct\n\n[![Release Version](https://img.shields.io/npm/v/jsx-destruct.svg)](https://www.npmjs.com/package/jsx-destruct)\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nThis tiny package allows you to unpack values directly in JSX statements. This helps avoid long object references and keeps declarations joined within your components.\n\n## Install\n\nInstall the package:\n\n```bash\nnpm install jsx-destruct\n```\n\n## Usage\n\n```js\nimport { Fragment } from 'react';\nimport { useQuery } from 'react-query';\nimport destruct from 'jsx-destruct';\n\nexport function SampleComponent () {\n\n  const { isLoading, data } = useQuery('repoData', async () =\u003e\n    fetch('https://api.github.com/repos/roydukkey/clean-package')\n      .then(async (res) =\u003e res.json())\n  );\n\n  return (\n    \u003cFragment\u003e\n      {isLoading \u0026\u0026 \u003cp\u003eLoading...\u003c/p\u003e}\n\n      {destruct(data, ({ name, description, owner: { login } }) =\u003e (\n        \u003cFragment\u003e\n          \u003ch1\u003e{name}\u003c/h1\u003e\n          \u003ch2\u003eby {login}\u003c/h2\u003e\n          \u003cp\u003e{description}\u003c/p\u003e\n        \u003c/Fragment\u003e\n      ))}\n    \u003c/Fragment\u003e\n  );\n\n}\n```\n\n## Inspiration\n\n1. jsx-control-statements' [`\u003cWith /\u003e` component](https://github.com/AlexGilleran/jsx-control-statements#with-tag)\n1. Handlebars' builtin [`#with` helper](https://handlebarsjs.com/guide/builtin-helpers.html#with)\n","funding_links":["https://github.com/sponsors/roydukkey"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froydukkey%2Fjsx-destruct","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froydukkey%2Fjsx-destruct","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froydukkey%2Fjsx-destruct/lists"}