{"id":22685465,"url":"https://github.com/shwilliam/react-use-hover-direction","last_synced_at":"2026-05-06T18:35:47.687Z","repository":{"id":42812566,"uuid":"269185727","full_name":"shwilliam/react-use-hover-direction","owner":"shwilliam","description":"👋 Custom hook to retrieve hover direction","archived":false,"fork":false,"pushed_at":"2022-03-26T20:19:05.000Z","size":468,"stargazers_count":0,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T06:08:10.443Z","etag":null,"topics":["hook","hover","mouseover","react"],"latest_commit_sha":null,"homepage":"","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/shwilliam.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-06-03T20:17:18.000Z","updated_at":"2020-06-03T20:40:04.000Z","dependencies_parsed_at":"2022-09-26T19:53:26.952Z","dependency_job_id":null,"html_url":"https://github.com/shwilliam/react-use-hover-direction","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shwilliam%2Freact-use-hover-direction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shwilliam%2Freact-use-hover-direction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shwilliam%2Freact-use-hover-direction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shwilliam%2Freact-use-hover-direction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shwilliam","download_url":"https://codeload.github.com/shwilliam/react-use-hover-direction/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246200324,"owners_count":20739567,"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","hover","mouseover","react"],"created_at":"2024-12-09T22:15:06.452Z","updated_at":"2026-05-06T18:35:47.657Z","avatar_url":"https://github.com/shwilliam.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React useHoverDirection\n\n![Example usage](https://user-images.githubusercontent.com/38357771/53678998-b326c680-3c94-11e9-8e4f-f65feee8651f.gif)\n\n## Installation\n\n```shell\nnpm i @shwilliam/react-use-hover-direction\n```\n\n## Usage\n\nImport `useHoverDirection` and call it in your React component with a `ref` to\nthe target component. For example:\n\n```jsx\nimport React, {useRef} from 'react'\nimport {useHoverDirection} from '@shwilliam/react-use-hover-direction'\n\nexport const App = () =\u003e {\n  const boxRef = useRef()\n  const mouseDirection = useHoverDirection(boxRef)\n\n  return (\n    \u003c\u003e\n      \u003cdiv ref={boxRef}\u003eHover me\u003c/div\u003e\n\n      \u003cp\u003e\n        {mouseDirection.x} {mouseDirection.y}\n      \u003c/p\u003e\n    \u003c/\u003e\n  )\n}\n```\n\n## Development\n\nTo start local development, simply install npm dependencies (`npm i`) and run\n`npm run dev` to watch ts files in `src/`. Built files can be found in `dist/`.\n\n## Demo\n\nTo run the demo, ensure you have run the build script and have a `dist` dir in\nyour project root. Then run `npm run demo:setup` to copy these to the demo.\nNavigate to the demo and install its dependencies (`cd demo \u0026\u0026 npm i`). You can\nnow start the demo app locally by running `npm start`.\n\n## Contributing\n\nThis project is open to and encourages contributions! Feel free to discuss any\nbug fixes/features in the [issues](https://github.com/shwilliam/react-use-hover-direction/issues).\nIf you wish to work on this project:\n\n1. Fork [this project](https://github.com/shwilliam/react-use-hover-direction)\n2. Create a branch (`git checkout -b new-branch`)\n3. Commit your changes (`git commit -am 'add new feature'`)\n4. Push to the branch (`git push origin new-branch`)\n5. [Submit a pull request!](https://github.com/shwilliam/react-use-hover-direction/pull/new/master)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshwilliam%2Freact-use-hover-direction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshwilliam%2Freact-use-hover-direction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshwilliam%2Freact-use-hover-direction/lists"}