From 984099158aa0d109e2d0f084c7464b61b04a1b64 Mon Sep 17 00:00:00 2001 From: Mark Date: Mon, 13 Jan 2025 01:56:55 -0500 Subject: [PATCH] refactor(components): replace createRef with useRef --- src/components/Button.tsx | 4 ++-- src/components/Typewriter.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/Button.tsx b/src/components/Button.tsx index 9dc53b8..2b71106 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -1,5 +1,5 @@ import type Phaser from 'phaser'; -import { createRef, Text } from 'phaser-jsx'; +import { Text, useRef } from 'phaser-jsx'; interface Props { center?: boolean; @@ -12,7 +12,7 @@ interface Props { export function Button(props: Props) { const { center, text, fixed, onClick, ...textProps } = props; - const ref = createRef(); + const ref = useRef(); function onMouseOver() { ref.current!.setTint(0xdddddd); diff --git a/src/components/Typewriter.tsx b/src/components/Typewriter.tsx index 07e7842..562611d 100644 --- a/src/components/Typewriter.tsx +++ b/src/components/Typewriter.tsx @@ -1,5 +1,5 @@ import type Phaser from 'phaser'; -import { createRef, Text, useScene } from 'phaser-jsx'; +import { Text, useRef, useScene } from 'phaser-jsx'; import { Depth } from '../constants'; @@ -13,7 +13,7 @@ interface Props { */ export function Typewriter(props: Props) { const scene = useScene(); - const ref = createRef(); + const ref = useRef(); let index = 0; const timer = scene.time.addEvent({