{"id":19414816,"url":"https://github.com/fcannizzaro/react-use-cookie-watcher","last_synced_at":"2025-04-24T12:32:07.636Z","repository":{"id":41732808,"uuid":"234324904","full_name":"fcannizzaro/react-use-cookie-watcher","owner":"fcannizzaro","description":"react hook to watch browser cookies","archived":false,"fork":false,"pushed_at":"2023-10-18T08:06:13.000Z","size":915,"stargazers_count":7,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-07T13:36:45.141Z","etag":null,"topics":["cookie","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/fcannizzaro.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}},"created_at":"2020-01-16T13:22:37.000Z","updated_at":"2022-12-31T23:31:22.000Z","dependencies_parsed_at":"2023-01-18T03:35:11.081Z","dependency_job_id":null,"html_url":"https://github.com/fcannizzaro/react-use-cookie-watcher","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/fcannizzaro%2Freact-use-cookie-watcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcannizzaro%2Freact-use-cookie-watcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcannizzaro%2Freact-use-cookie-watcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcannizzaro%2Freact-use-cookie-watcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fcannizzaro","download_url":"https://codeload.github.com/fcannizzaro/react-use-cookie-watcher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223954237,"owners_count":17231186,"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":["cookie","react","react-hooks"],"created_at":"2024-11-10T12:39:55.379Z","updated_at":"2024-11-10T12:39:56.010Z","avatar_url":"https://github.com/fcannizzaro.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @fcannizzaro/react-use-cookie-watcher\n\n\u003e react hook to watch browser cookies\n\n[![NPM](https://img.shields.io/npm/v/@fcannizzaro/react-use-cookie-watcher.svg)](https://www.npmjs.com/package/@fcannizzaro/react-use-cookie-watcher) [![Test](https://github.com/fcannizzaro/react-use-cookie-watcher/actions/workflows/test.yml/badge.svg)](https://github.com/fcannizzaro/react-use-cookie-watcher/actions/workflows/test.yml)\n\n## Install\n\n```bash\nnpm i @fcannizzaro/react-use-cookie-watcher\n# yarn add @fcannizzaro/react-use-cookie-watcher\n# pnpm add @fcannizzaro/react-use-cookie-watcher\n```\n\n## Usage\n\n```jsx\nimport React, {Component} from 'react'\n\nimport {useCookieWatcher, useCookie} from '@fcannizzaro/react-use-cookie-watcher'\n\nconst Example = () =\u003e {\n\n    // cookie existence\n    const isNotExpired = useCookieWatcher('react-cookie', {\n        // check for changes every 500ms\n        checkEvery: 500\n    });\n\n    // cookie value (updated on change)\n    const value = useCookieWatcher('react-cookie', {\n        valueOnly: 500\n    });\n\n    // cookie value (at call time)\n    const cookie = useCookie('react-cookie');\n\n    return \u003cdiv\u003e\n        \u003cp\u003ecookie {isNotExpired ? 'found' : 'not found'}\u003c/p\u003e\n        \u003cp\u003ecookie value = {value}\u003c/p\u003e\n    \u003c/div\u003e\n\n}\n```\n\n## 2.0.0 Breaking Changes\n\n- added typescript support\n- `useCookieWatcher` now can return a boolean value or a string value (if `valueOnly` is set to `true`)\n- `useCookieWatcher` now accepts an options object as second parameter\n\n## License\n\nMIT © [fcannizzaro](https://github.com/fcannizzaro)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcannizzaro%2Freact-use-cookie-watcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffcannizzaro%2Freact-use-cookie-watcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcannizzaro%2Freact-use-cookie-watcher/lists"}