{"id":20569018,"url":"https://github.com/kenmueller/use-delayed-unmount","last_synced_at":"2026-04-10T21:41:51.951Z","repository":{"id":57388018,"uuid":"310506638","full_name":"kenmueller/use-delayed-unmount","owner":"kenmueller","description":"Delay the unmount of a component to apply an unmount animation","archived":false,"fork":false,"pushed_at":"2023-03-18T19:31:42.000Z","size":3,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-25T02:43:17.600Z","etag":null,"topics":[],"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/kenmueller.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-06T06:02:57.000Z","updated_at":"2023-08-13T07:45:32.000Z","dependencies_parsed_at":"2024-10-06T17:14:07.434Z","dependency_job_id":"78eaf1fc-3a97-4d91-b43c-b8b5762b0747","html_url":"https://github.com/kenmueller/use-delayed-unmount","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenmueller%2Fuse-delayed-unmount","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenmueller%2Fuse-delayed-unmount/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenmueller%2Fuse-delayed-unmount/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenmueller%2Fuse-delayed-unmount/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kenmueller","download_url":"https://codeload.github.com/kenmueller/use-delayed-unmount/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242182841,"owners_count":20085569,"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-11-16T04:55:35.462Z","updated_at":"2026-04-10T21:41:46.925Z","avatar_url":"https://github.com/kenmueller.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# useDelayedUnmount\n\n\u003e Delay the unmount of a component to apply an unmount animation.\n\n## What does it do?\n\nBy delaying the unmounting of a component, you can apply an animation before the component unmounts. This is useful for modals, dropdowns, and a bunch of other scenarios since CSS does not natively support unmount animations.\n\n## Example\n\n```js\nimport useDelayedUnmount from 'use-delayed-unmount'\n\nconst Home = () =\u003e {\n    const [[isMounted, isUnmounting], setIsMounted] = useDelayedUnmount(false, 300)\n    \n    return (\n        \u003c\u003e\n            \u003cbutton onClick={() =\u003e setIsMounted(!isMounted)}\u003e\n                Toggle\n            \u003c/button\u003e\n            {isMounted \u0026\u0026 (\n                \u003cp className={isUnmounting ? 'hide' : ''}\u003e\n                    Hello!\n                \u003c/p\u003e\n            )}\n        \u003c/\u003e\n    )\n}\n```\n\n```css\np {\n    animation: show 0.3s linear;\n}\n\n.hide {\n    animation: hide 0.3s linear;\n}\n\n@keyframes show {\n    from { opacity: 0; }\n}\n\n@keyframes hide {\n    to { opacity: 0; }\n}\n```\n\n## How it works\n\nWhen `setIsMounted` is called with `true`, the component is immmediately mounted. When `setIsMounted` is called with `false`, `isUnmounting` is set to `true` and `isMounted` is set to false only after the specified delay.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenmueller%2Fuse-delayed-unmount","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkenmueller%2Fuse-delayed-unmount","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenmueller%2Fuse-delayed-unmount/lists"}