1.code
import React, { useState } from 'react';
const MouseTracker = () => {
const [mousePosition, setMousePosition] = useState({ x: 0, y: 0 });
const handleMouseMove = (e) => {
setMousePosition({ x: e.clientX, y: e.clientY });
};
return (
<div
style={{ width: '100%', height: '100vh' }}
onMouseMove={handleMouseMove}
>
<h1>Mouse Tracker</h1>
<p>Mouse X: {mousePosition.x}</p>
<p>Mouse Y: {mousePosition.y}</p>
</div>
);
};
export default MouseTracker;
2.實作最近有點忙,原本想做能上傳圖片並切割的拼圖遊戲,但有點問題,只能上傳不能切割,查了一下是少了一些額外的東西需要下載才能進行切割......所以時間管理真的很重要。