From 4adf31a7577e99087d1d15984dd401c15cdcc9ed Mon Sep 17 00:00:00 2001 From: xjq7 Date: Tue, 12 Nov 2024 18:37:19 +0800 Subject: [PATCH] feat: stash --- src/pages/2048/index.tsx | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/pages/2048/index.tsx b/src/pages/2048/index.tsx index 631b253..300c1d9 100644 --- a/src/pages/2048/index.tsx +++ b/src/pages/2048/index.tsx @@ -1,3 +1,21 @@ -export default function G2048() { - return
; +import { useEffect, useRef } from 'react'; + +export default function Component() { + const canvasRef = useRef(); + + const draw = () => { + const canvas = canvasRef.current; + const ctx = canvasRef.current.getContext('2d'); + console.log(canvas, ctx); + }; + + useEffect(() => { + draw(); + }, []); + + return ( +
+ +
+ ); }