Skip to content

Commit

Permalink
refactor(components): replace createRef with useRef
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Jan 13, 2025
1 parent bcb3ad7 commit 9840991
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -12,7 +12,7 @@ interface Props {

export function Button(props: Props) {
const { center, text, fixed, onClick, ...textProps } = props;
const ref = createRef<Phaser.GameObjects.Text>();
const ref = useRef<Phaser.GameObjects.Text>();

function onMouseOver() {
ref.current!.setTint(0xdddddd);
Expand Down
4 changes: 2 additions & 2 deletions src/components/Typewriter.tsx
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -13,7 +13,7 @@ interface Props {
*/
export function Typewriter(props: Props) {
const scene = useScene();
const ref = createRef<Phaser.GameObjects.Text>();
const ref = useRef<Phaser.GameObjects.Text>();
let index = 0;

const timer = scene.time.addEvent({
Expand Down

0 comments on commit 9840991

Please sign in to comment.