{"id":15041891,"url":"https://github.com/discord/use-memo-value","last_synced_at":"2025-04-06T01:10:58.450Z","repository":{"id":42874291,"uuid":"257441209","full_name":"discord/use-memo-value","owner":"discord","description":"Reuse the previous version of a value unless it has changed","archived":false,"fork":false,"pushed_at":"2023-10-04T14:42:36.000Z","size":501,"stargazers_count":168,"open_issues_count":15,"forks_count":11,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-30T00:11:04.176Z","etag":null,"topics":["memoize","react","react-hooks"],"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/discord.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}},"created_at":"2020-04-21T00:43:26.000Z","updated_at":"2024-11-05T00:46:52.000Z","dependencies_parsed_at":"2024-06-18T21:10:26.088Z","dependency_job_id":"4474f7a6-ae34-423f-a971-8572581981a1","html_url":"https://github.com/discord/use-memo-value","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"af91650bb26ef3a7c90b1fae2b440c5f4d2587d4"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discord%2Fuse-memo-value","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discord%2Fuse-memo-value/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discord%2Fuse-memo-value/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discord%2Fuse-memo-value/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/discord","download_url":"https://codeload.github.com/discord/use-memo-value/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419861,"owners_count":20936012,"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":["memoize","react","react-hooks"],"created_at":"2024-09-24T20:46:36.220Z","updated_at":"2025-04-06T01:10:58.417Z","avatar_url":"https://github.com/discord.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `useMemoValue()`\n\n\u003e Reuse the previous version of a value unless it has changed\n\n## Install\n\n```sh\nnpm install --save-dev use-memo-value\n```\n\n## Usage\n\nIf you don't know all the members of an object, you may want to use a \"shallow\ncompare\" to memoize the value so you can rely on React's referential equality\n(such as in `useEffect(..., deps)`).\n\n```js\nimport useMemoValue from \"use-memo-value\"\n\nfunction MyComponent(props) {\n  let rawParams = getCurrentUrlQueryParams() // we don't know the shape of this object\n  let memoizedParams = useMemoValue(rawParams)\n\n  useEffect(() =\u003e {\n    search(memoizedParams)\n  }, [memoizedParams])\n\n  // ...\n}\n```\n\n\u003e **Note:** If you know the shape of your object, you are likely better off not\n\u003e using this library.\n\nIf you need to customize how the values are compared, you can pass a comparator\nas a second argument:\n\n```js\nlet memoizedValue = useMemoValue(rawValue, (nextValue, previousValue) =\u003e {\n  return Object.is(a, b) // or whatever\n})\n```\n\nThe comparator will not be called until there's a new value.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiscord%2Fuse-memo-value","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiscord%2Fuse-memo-value","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiscord%2Fuse-memo-value/lists"}