Skip to content

Commit

Permalink
feat: stash
Browse files Browse the repository at this point in the history
  • Loading branch information
xjq7 committed Nov 12, 2024
1 parent f426da1 commit 4adf31a
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/pages/2048/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
export default function G2048() {
return <div></div>;
import { useEffect, useRef } from 'react';

export default function Component() {
const canvasRef = useRef<HTMLCanvasElement>();

const draw = () => {
const canvas = canvasRef.current;
const ctx = canvasRef.current.getContext('2d');
console.log(canvas, ctx);
};

useEffect(() => {
draw();
}, []);

return (
<div className="w-[100vw] h-[100vh] flex items-center justify-center background-[#aaa] flex-col">
<canvas width={600} height={600} ref={canvasRef}></canvas>
</div>
);
}

0 comments on commit 4adf31a

Please sign in to comment.