Socket
Socket
Sign inDemoInstall

react-use-mouse-position

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-use-mouse-position

A light npm package to track mouse position


Version published
Weekly downloads
81
decreased by-17.35%
Maintainers
1
Weekly downloads
 
Created
Source
npm

useMousePosition - a custom React hook

  • A lightweight (508 B) package to easily track mouse position in Reactjs
  • Very useful for tinder style cards and other draggable elements
  • v1.0.2 adds a variety of touch events, improving mobile usability

Install

npm install react-use-mouse-position

Example

import React from "react";
import { useMousePosition } from "react-use-mouse-position";

function MyApp() {
  const { mouseX, mouseY } = useMousePosition();
  console.log("mouseX:", mouseX);
}

useMousePosition returns

NameTypeDefaultDescription
mouseXnumThe mouses current x position
mouseYnumThe mouses current y position

License

Code released under the MIT license.

Keywords

FAQs

Package last updated on 04 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc