diff --git a/packages/example/src/TestUi1Component.tsx b/packages/example/src/TestUi1Component.tsx index fc5dc3a..cfdc55f 100644 --- a/packages/example/src/TestUi1Component.tsx +++ b/packages/example/src/TestUi1Component.tsx @@ -1,5 +1,5 @@ import Godot, { Vector2 } from "godot" -import { useEffect } from "react" +import { useEffect, useState } from "react" import { Component } from "react-godot-renderer" @@ -9,12 +9,14 @@ const TextEdit = Component.make(Godot.TextEdit) const Button = Component.make(Godot.Button) export function TestUi1Component() { + const [text, setText] = useState("Default text") + const textEditRef = TextEdit.useUnsafeRef() const buttonRef = Button.useUnsafeRef() useEffect(() => { const onTextChanged = Godot.Callable.create(() => { - console.log(textEditRef.current.text) + setText(textEditRef.current.text) }) textEditRef.current.text_changed.connect(onTextChanged) @@ -46,7 +48,7 @@ export function TestUi1Component() {