MCPcopy Create free account
hub / github.com/Klerith/react-hooks / Message

Function Message

src/02-useEffect/Message.jsx:3–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import { useEffect, useState } from "react"
2
3export const Message = () => {
4
5 const [coords, setCoords] = useState({ x: 0, y: 0});
6
7 useEffect(() => {
8
9 const onMouseMove = ({ x, y }) => {
10 // const coords = { x, y };
11 setCoords({ x, y })
12 }
13
14 window.addEventListener( 'mousemove', onMouseMove );
15
16 return () => {
17 window.removeEventListener( 'mousemove', onMouseMove );
18 }
19 }, []);
20
21
22
23 return (
24 <>
25 <h3>Usuario ya existe</h3>
26 { JSON.stringify( coords ) }
27 </>
28 )
29}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected