{"id":13450259,"url":"https://github.com/MarvelSQ/use-properties-hook","last_synced_at":"2025-03-23T16:31:08.236Z","repository":{"id":76626511,"uuid":"174310770","full_name":"MarvelSQ/use-properties-hook","owner":"MarvelSQ","description":"A React hook - instance variables with useRef","archived":false,"fork":false,"pushed_at":"2019-03-10T16:13:13.000Z","size":32,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-08T09:32:54.572Z","etag":null,"topics":["hook","react"],"latest_commit_sha":null,"homepage":null,"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/MarvelSQ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-03-07T09:13:16.000Z","updated_at":"2019-12-27T23:30:32.000Z","dependencies_parsed_at":"2023-06-12T12:15:38.246Z","dependency_job_id":null,"html_url":"https://github.com/MarvelSQ/use-properties-hook","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"57d59affe64313a3770c21028457d6e64e00f524"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarvelSQ%2Fuse-properties-hook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarvelSQ%2Fuse-properties-hook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarvelSQ%2Fuse-properties-hook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarvelSQ%2Fuse-properties-hook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MarvelSQ","download_url":"https://codeload.github.com/MarvelSQ/use-properties-hook/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245130727,"owners_count":20565701,"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":["hook","react"],"created_at":"2024-07-31T07:00:32.861Z","updated_at":"2025-03-23T16:31:07.928Z","avatar_url":"https://github.com/MarvelSQ.png","language":"JavaScript","funding_links":[],"categories":["Packages"],"sub_categories":[],"readme":"# use-properties-hook\n\nbind variables to current Component, like **_class-properties_**\n\n## install\n\n```\nnpm install @marvelsq/use-properties-hook\n```\n\n## use\n- **useProperty(any):any** bind single variable\n- **useProperties(...any):[...any]** bind multiple variable\n```js\nimport React, { useState } from 'react';\nimport { useProperties } from '@marvelsq/use-properties-hook';\n\nexport default function App({ data, updateData }) {\n  // state\n  const [active, setActive] = useState(null);\n  // functions always same\n  const [handleClick, handleRemove] = useProperties(\n    index =\u003e setActive(index),\n    targetIndex =\u003e {\n      updateData(data.filter((data, index) =\u003e targetIndex !== index));\n      setActive(data[index - 1] ? index - 1 : null);\n    }\n  );\n\n  return \u003cTable data={data} onClick={handleClick} onRemove={handleRemove} /\u003e;\n}\n```\n\n**inspired by [Making setInterval Declarative with React Hooks](https://overreacted.io/making-setinterval-declarative-with-react-hooks/)**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMarvelSQ%2Fuse-properties-hook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMarvelSQ%2Fuse-properties-hook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMarvelSQ%2Fuse-properties-hook/lists"}